Manual merge from mysql-next-mr.

Conflicts:
  - storage/ibmdb2i/ha_ibmdb2i.cc
This commit is contained in:
Alexander Nozdrin 2009-12-22 09:32:58 +03:00
commit 6f8073497c
208 changed files with 6651 additions and 2419 deletions

View file

@ -1303,7 +1303,11 @@ set_linux_configs()
compiler_flags="$compiler_flags -m32"
fi
if test "x$fast_flag" != "xno" ; then
compiler_flags="$compiler_flags -O2"
if test "x$fast_flag" = "xyes" ; then
compiler_flags="$compiler_flags -O3"
else
compiler_flags="$compiler_flags -O2"
fi
else
compiler_flags="$compiler_flags -O0"
fi

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2001-2006 MySQL AB
/* Copyright (C) 2001-2006 MySQL AB, 2009 Sun Microsystems, Inc
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -87,3 +87,24 @@ enum options_client
OPT_INIT_COMMAND,
OPT_MAX_CLIENT_OPTION
};
/**
First mysql version supporting the information schema.
*/
#define FIRST_INFORMATION_SCHEMA_VERSION 50003
/**
Name of the information schema database.
*/
#define INFORMATION_SCHEMA_DB_NAME "information_schema"
/**
First mysql version supporting the performance schema.
*/
#define FIRST_PERFORMANCE_SCHEMA_VERSION 50600
/**
Name of the performance schema database.
*/
#define PERFORMANCE_SCHEMA_DB_NAME "performance_schema"

View file

@ -783,6 +783,10 @@ static int run_sql_fix_privilege_tables(void)
found_real_errors++;
print_line(line);
}
else if (strncmp(line, "WARNING", 7) == 0)
{
print_line(line);
}
} while ((line= get_line(line)) && *line);
}

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB
/* Copyright (C) 2000 MySQL AB, 2009 Sun Microsystems, Inc
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
@ -643,8 +643,11 @@ static int process_one_db(char *database)
static int use_db(char *database)
{
if (mysql_get_server_version(sock) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
if (mysql_get_server_version(sock) >= FIRST_INFORMATION_SCHEMA_VERSION &&
!my_strcasecmp(&my_charset_latin1, database, INFORMATION_SCHEMA_DB_NAME))
return 1;
if (mysql_get_server_version(sock) >= FIRST_PERFORMANCE_SCHEMA_VERSION &&
!my_strcasecmp(&my_charset_latin1, database, PERFORMANCE_SCHEMA_DB_NAME))
return 1;
if (mysql_select_db(sock, database))
{

View file

@ -3837,8 +3837,12 @@ static int dump_all_databases()
return 1;
while ((row= mysql_fetch_row(tableres)))
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, row[0], "information_schema"))
if (mysql_get_server_version(mysql) >= FIRST_INFORMATION_SCHEMA_VERSION &&
!my_strcasecmp(&my_charset_latin1, row[0], INFORMATION_SCHEMA_DB_NAME))
continue;
if (mysql_get_server_version(mysql) >= FIRST_PERFORMANCE_SCHEMA_VERSION &&
!my_strcasecmp(&my_charset_latin1, row[0], PERFORMANCE_SCHEMA_DB_NAME))
continue;
if (dump_all_tables_in_db(row[0]))
@ -3855,8 +3859,12 @@ static int dump_all_databases()
}
while ((row= mysql_fetch_row(tableres)))
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, row[0], "information_schema"))
if (mysql_get_server_version(mysql) >= FIRST_INFORMATION_SCHEMA_VERSION &&
!my_strcasecmp(&my_charset_latin1, row[0], INFORMATION_SCHEMA_DB_NAME))
continue;
if (mysql_get_server_version(mysql) >= FIRST_PERFORMANCE_SCHEMA_VERSION &&
!my_strcasecmp(&my_charset_latin1, row[0], PERFORMANCE_SCHEMA_DB_NAME))
continue;
if (dump_all_views_in_db(row[0]))
@ -4257,10 +4265,12 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
}
end= pos;
/* Can't LOCK TABLES in INFORMATION_SCHEMA, so don't try. */
/* Can't LOCK TABLES in I_S / P_S, so don't try. */
if (lock_tables &&
!(mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, db, "information_schema")))
!(mysql_get_server_version(mysql) >= FIRST_INFORMATION_SCHEMA_VERSION &&
!my_strcasecmp(&my_charset_latin1, db, INFORMATION_SCHEMA_DB_NAME)) &&
!(mysql_get_server_version(mysql) >= FIRST_PERFORMANCE_SCHEMA_VERSION &&
!my_strcasecmp(&my_charset_latin1, db, PERFORMANCE_SCHEMA_DB_NAME)))
{
if (mysql_real_query(mysql, lock_tables_query.str,
lock_tables_query.length-1))

View file

@ -880,10 +880,74 @@ AC_CHECK_DECLS(MHA_MAPSIZE_VA,
#include <sys/mman.h>
]
)
fi
dnl Use of ALARMs to wakeup on timeout on sockets
dnl
dnl This feature makes use of a mutex and is a scalability hog we
dnl try to avoid using. However we need support for SO_SNDTIMEO and
dnl SO_RCVTIMEO socket options for this to work. So we will check
dnl if this feature is supported by a simple AC_RUN_IFELSE macro. However
dnl on some OS's there is support for setting those variables but
dnl they are silently ignored. For those OS's we will not attempt
dnl o use SO_SNDTIMEO and SO_RCVTIMEO even if it is said to work.
dnl See Bug#29093 for the problem with SO_SND/RCVTIMEO on HP/UX.
dnl To use alarm is simple, simply avoid setting anything.
AC_CACHE_CHECK([whether SO_SNDTIMEO and SO_RCVTIMEO work],
[mysql_cv_socket_timeout],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
]],[[
int fd = socket(AF_INET, SOCK_STREAM, 0);
struct timeval tv;
int ret= 0;
tv.tv_sec= 2;
tv.tv_usec= 0;
ret|= setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
ret|= setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
return !!ret;
]])],
[mysql_cv_socket_timeout=yes],
[mysql_cv_socket_timeout=no],
[mysql_cv_socket_timeout=no
AC_MSG_WARN([Socket timeout options disabled due to cross-compiling])])
])
use_alarm=yes
if test "$mysql_cv_socket_timeout" = yes; then
case $SYSTEM_TYPE in
dnl We trust the result from the following systems
*solaris*) use_alarm=no ;;
*freebsd*) use_alarm=no ;;
*darwin*) use_alarm=no ;;
*)
dnl We trust the result from Linux also
if test "$TARGET_LINUX" = "true"; then
use_alarm=no
fi
dnl We trust no one else for the moment
dnl (Windows is hardcoded to not use alarms)
;;
esac
fi
AC_ARG_WITH(alarm,
AS_HELP_STRING([--with-alarm], [Use alarm to implement socket timeout.]),
[use_alarm=$withval], [])
AC_MSG_CHECKING(whether to use alarms to implement socket timeout)
if test "$use_alarm" = no ; then
AC_DEFINE([NO_ALARM], [1], [No need to use alarm for socket timeout])
AC_DEFINE([SIGNAL_WITH_VIO_CLOSE], [1], [Need to use vio close for kill connection])
fi
AC_MSG_RESULT($use_alarm)
#--------------------------------------------------------------------
# Check for IPv6 support
#--------------------------------------------------------------------
@ -1825,6 +1889,7 @@ AC_CACHE_CHECK([whether the compiler provides atomic builtins],
],
[[
int foo= -10; int bar= 10;
long long int foo64= -10; long long int bar64= 10;
if (!__sync_fetch_and_add(&foo, bar) || foo)
return -1;
bar= __sync_lock_test_and_set(&foo, bar);
@ -1833,6 +1898,14 @@ AC_CACHE_CHECK([whether the compiler provides atomic builtins],
bar= __sync_val_compare_and_swap(&bar, foo, 15);
if (bar)
return -1;
if (!__sync_fetch_and_add(&foo64, bar64) || foo64)
return -1;
bar64= __sync_lock_test_and_set(&foo64, bar64);
if (bar64 || foo64 != 10)
return -1;
bar64= __sync_val_compare_and_swap(&bar64, foo, 15);
if (bar64)
return -1;
return 0;
]]
)],
@ -1849,11 +1922,12 @@ AC_CACHE_CHECK([whether the OS provides atomic_* functions like Solaris],
[mysql_cv_solaris_atomic],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[
[[
#include <atomic.h>
]
]],
[[
int foo = -10; int bar = 10;
int64_t foo64 = -10; int64_t bar64 = 10;
if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
return -1;
bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
@ -1862,6 +1936,15 @@ AC_CACHE_CHECK([whether the OS provides atomic_* functions like Solaris],
bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
if (bar)
return -1;
if (atomic_add_64_nv((volatile uint64_t *)&foo64, bar64) || foo64)
return -1;
bar64 = atomic_swap_64((volatile uint64_t *)&foo64, (uint64_t)bar64);
if (bar64 || foo64 != 10)
return -1;
bar64 = atomic_cas_64((volatile uint64_t *)&bar64, (uint_t)foo64, 15);
if (bar64)
return -1;
atomic_or_64((volatile uint64_t *)&bar64, 0);
return 0;
]]
)],
@ -2166,7 +2249,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
sighold sigset sigthreadmask port_create sleep thr_yield \
snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
strtol strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd)
posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd printstack)
#
#

View file

@ -23,6 +23,7 @@
*/
#undef MY_ATOMIC_HAS_8_16
#include <windows.h>
/*
x86 compilers (both VS2003 or VS2005) never use instrinsics, but generate
function calls to kernel32 instead, even in the optimized build.
@ -36,19 +37,17 @@
#else
C_MODE_START
/*Visual Studio 2003 and earlier do not have prototypes for atomic intrinsics*/
LONG _InterlockedExchange (LONG volatile *Target,LONG Value);
LONG _InterlockedCompareExchange (LONG volatile *Target, LONG Value, LONG Comp);
LONG _InterlockedExchangeAdd (LONG volatile *Addend, LONG Value);
LONGLONG _InterlockedCompareExchange64 (LONGLONG volatile *Target,
LONGLONG Value, LONGLONG Comp);
C_MODE_END
#pragma intrinsic(_InterlockedExchangeAdd)
#pragma intrinsic(_InterlockedCompareExchange)
#pragma intrinsic(_InterlockedExchange)
#pragma intrinsic(_InterlockedCompareExchange64)
#endif
#define InterlockedExchange _InterlockedExchange
#define InterlockedExchangeAdd _InterlockedExchangeAdd
#define InterlockedCompareExchange _InterlockedCompareExchange
#define InterlockedCompareExchange64 _InterlockedCompareExchange64
/*
No need to do something special for InterlockedCompareExchangePointer
as it is a #define to InterlockedCompareExchange. The same applies to
@ -57,23 +56,39 @@ C_MODE_END
#endif /*_M_IX86*/
#define MY_ATOMIC_MODE "msvc-intrinsics"
#define IL_EXCHG_ADD32(X,Y) InterlockedExchangeAdd((volatile LONG *)(X),(Y))
#define IL_COMP_EXCHG32(X,Y,Z) InterlockedCompareExchange((volatile LONG *)(X),(Y),(Z))
/* Implement using CAS on WIN32 */
#define IL_COMP_EXCHG32(X,Y,Z) \
InterlockedCompareExchange((volatile LONG *)(X),(Y),(Z))
#define IL_COMP_EXCHG64(X,Y,Z) \
InterlockedCompareExchange64((volatile LONGLONG *)(X), \
(LONGLONG)(Y),(LONGLONG)(Z))
#define IL_COMP_EXCHGptr InterlockedCompareExchangePointer
#define IL_EXCHG32(X,Y) InterlockedExchange((volatile LONG *)(X),(Y))
#define IL_EXCHGptr InterlockedExchangePointer
#define make_atomic_add_body(S) \
v= IL_EXCHG_ADD ## S (a, v)
#define make_atomic_cas_body(S) \
int ## S initial_cmp= *cmp; \
int ## S initial_a= IL_COMP_EXCHG ## S (a, set, initial_cmp); \
if (!(ret= (initial_a == initial_cmp))) *cmp= initial_a;
#ifndef _M_IX86
/* Use full set of optimised functions on WIN64 */
#define IL_EXCHG_ADD32(X,Y) \
InterlockedExchangeAdd((volatile LONG *)(X),(Y))
#define IL_EXCHG_ADD64(X,Y) \
InterlockedExchangeAdd64((volatile LONGLONG *)(X),(LONGLONG)(Y))
#define IL_EXCHG32(X,Y) \
InterlockedExchange((volatile LONG *)(X),(Y))
#define IL_EXCHG64(X,Y) \
InterlockedExchange64((volatile LONGLONG *)(X),(LONGLONG)(Y))
#define IL_EXCHGptr InterlockedExchangePointer
#define make_atomic_add_body(S) \
v= IL_EXCHG_ADD ## S (a, v)
#define make_atomic_swap_body(S) \
v= IL_EXCHG ## S (a, v)
#define make_atomic_load_body(S) \
ret= 0; /* avoid compiler warning */ \
ret= IL_COMP_EXCHG ## S (a, ret, ret);
#endif
/*
my_yield_processor (equivalent of x86 PAUSE instruction) should be used
to improve performance on hyperthreaded CPUs. Intel recommends to use it in
@ -108,9 +123,12 @@ static __inline int my_yield_processor()
#else /* cleanup */
#undef IL_EXCHG_ADD32
#undef IL_EXCHG_ADD64
#undef IL_COMP_EXCHG32
#undef IL_COMP_EXCHG64
#undef IL_COMP_EXCHGptr
#undef IL_EXCHG32
#undef IL_EXCHG64
#undef IL_EXCHGptr
#endif

View file

@ -17,23 +17,37 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#if defined(__i386__) || defined(_MSC_VER) || defined(__x86_64__) \
|| defined(HAVE_GCC_ATOMIC_BUILTINS)
|| defined(HAVE_GCC_ATOMIC_BUILTINS) \
|| defined(HAVE_SOLARIS_ATOMIC)
# ifdef MY_ATOMIC_MODE_DUMMY
# define LOCK_prefix ""
# else
# define LOCK_prefix "lock"
# endif
# ifdef HAVE_GCC_ATOMIC_BUILTINS
# include "gcc_builtins.h"
# elif __GNUC__
# include "x86-gcc.h"
# elif defined(_MSC_VER)
/*
We choose implementation as follows:
------------------------------------
On Windows using Visual C++ the native implementation should be
preferrable. When using gcc we prefer the native x86 implementation,
we prefer the Solaris implementation before the gcc because of
stability preference, we choose gcc implementation if nothing else
works on gcc. If neither Visual C++ or gcc we still choose the
Solaris implementation on Solaris (mainly for SunStudio compiles.
*/
# if defined(_MSV_VER)
# include "generic-msvc.h"
# elif __GNUC__
# if defined(__i386__) || defined(__x86_64__)
# include "x86-gcc.h"
# elif defined(HAVE_SOLARIS_ATOMIC)
# include "solaris.h"
# elif defined(HAVE_GCC_ATOMIC_BUILTINS)
# include "gcc_builtins.h"
# endif
# elif defined(HAVE_SOLARIS_ATOMIC)
# include "solaris.h"
# endif
#elif defined(HAVE_SOLARIS_ATOMIC)
#include "solaris.h"
#endif
#if defined(make_atomic_cas_body) || defined(MY_ATOMICS_MADE)

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2008 MySQL AB
/* Copyright (C) 2008 MySQL AB, 2009 Sun Microsystems, Inc
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
@ -60,6 +60,18 @@ my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set)
return ret;
}
STATIC_INLINE int
my_atomic_cas64(int64 volatile *a, int64 *cmp, int64 set)
{
int ret;
int64 sav;
sav = (int64) atomic_cas_64((volatile uint64_t *)a, (uint64_t)*cmp,
(uint64_t)set);
if (! (ret = (sav == *cmp)))
*cmp = sav;
return ret;
}
STATIC_INLINE int
my_atomic_casptr(void * volatile *a, void **cmp, void *set)
{
@ -97,6 +109,14 @@ my_atomic_add32(int32 volatile *a, int32 v)
return (nv - v);
}
STATIC_INLINE int64
my_atomic_add64(int64 volatile *a, int64 v)
{
int64 nv;
nv = atomic_add_64_nv((volatile uint64_t *)a, v);
return (nv - v);
}
/* ------------------------------------------------------------------------ */
#ifdef MY_ATOMIC_MODE_DUMMY
@ -110,6 +130,9 @@ my_atomic_load16(int16 volatile *a) { return (*a); }
STATIC_INLINE int32
my_atomic_load32(int32 volatile *a) { return (*a); }
STATIC_INLINE int64
my_atomic_load64(int64 volatile *a) { return (*a); }
STATIC_INLINE void *
my_atomic_loadptr(void * volatile *a) { return (*a); }
@ -124,6 +147,9 @@ my_atomic_store16(int16 volatile *a, int16 v) { *a = v; }
STATIC_INLINE void
my_atomic_store32(int32 volatile *a, int32 v) { *a = v; }
STATIC_INLINE void
my_atomic_store64(int64 volatile *a, int64 v) { *a = v; }
STATIC_INLINE void
my_atomic_storeptr(void * volatile *a, void *v) { *a = v; }
@ -149,6 +175,12 @@ my_atomic_load32(int32 volatile *a)
return ((int32) atomic_or_32_nv((volatile uint32_t *)a, 0));
}
STATIC_INLINE int64
my_atomic_load64(int64 volatile *a)
{
return ((int64) atomic_or_64_nv((volatile uint64_t *)a, 0));
}
STATIC_INLINE void *
my_atomic_loadptr(void * volatile *a)
{
@ -175,6 +207,12 @@ my_atomic_store32(int32 volatile *a, int32 v)
(void) atomic_swap_32((volatile uint32_t *)a, (uint32_t)v);
}
STATIC_INLINE void
my_atomic_store64(int64 volatile *a, int64 v)
{
(void) atomic_swap_64((volatile uint64_t *)a, (uint64_t)v);
}
STATIC_INLINE void
my_atomic_storeptr(void * volatile *a, void *v)
{
@ -203,6 +241,12 @@ my_atomic_fas32(int32 volatile *a, int32 v)
return ((int32) atomic_swap_32((volatile uint32_t *)a, (uint32_t)v));
}
STATIC_INLINE int64
my_atomic_fas64(int64 volatile *a, int64 v)
{
return ((int64) atomic_swap_64((volatile uint64_t *)a, (uint64_t)v));
}
STATIC_INLINE void *
my_atomic_fasptr(void * volatile *a, void *v)
{

View file

@ -22,6 +22,12 @@
architectures support double-word (128-bit) cas.
*/
/*
No special support of 8 and 16 bit operations are implemented here
currently.
*/
#undef MY_ATOMIC_HAS_8_AND_16
#ifdef __x86_64__
# ifdef MY_ATOMIC_NO_XADD
# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix "-no-xadd"
@ -42,29 +48,79 @@
#endif
#ifndef MY_ATOMIC_NO_XADD
#define make_atomic_add_body(S) \
asm volatile (LOCK_prefix "; xadd %0, %1;" : "+r" (v) , "+m" (*a))
#define make_atomic_add_body(S) make_atomic_add_body ## S
#define make_atomic_cas_body(S) make_atomic_cas_body ## S
#endif
#define make_atomic_fas_body(S) \
asm volatile ("xchg %0, %1;" : "+q" (v) , "+m" (*a))
#define make_atomic_cas_body(S) \
#define make_atomic_add_body32 \
asm volatile (LOCK_prefix "; xadd %0, %1;" : "+r" (v) , "+m" (*a))
#define make_atomic_cas_body32 \
asm volatile (LOCK_prefix "; cmpxchg %3, %0; setz %2;" \
: "+m" (*a), "+a" (*cmp), "=q" (ret): "r" (set))
#ifdef MY_ATOMIC_MODE_DUMMY
#define make_atomic_load_body(S) ret=*a
#define make_atomic_store_body(S) *a=v
#else
#ifdef __x86_64__
#define make_atomic_add_body64 make_atomic_add_body32
#define make_atomic_cas_body64 make_atomic_cas_body32
#define make_atomic_fas_body(S) \
asm volatile ("xchg %0, %1;" : "+r" (v) , "+m" (*a))
/*
Actually 32-bit reads/writes are always atomic on x86
But we add LOCK_prefix here anyway to force memory barriers
*/
#define make_atomic_load_body(S) \
ret=0; \
asm volatile (LOCK_prefix "; cmpxchg %2, %0" \
: "+m" (*a), "+a" (ret): "r" (ret))
#define make_atomic_store_body(S) \
#define make_atomic_load_body(S) \
ret=0; \
asm volatile (LOCK_prefix "; cmpxchg %2, %0" \
: "+m" (*a), "+a" (ret): "r" (ret))
#define make_atomic_store_body(S) \
asm volatile ("; xchg %0, %1;" : "+m" (*a), "+r" (v))
#else
/*
Use default implementations of 64-bit operations since we solved
the 64-bit problem on 32-bit platforms for CAS, no need to solve it
once more for ADD, LOAD, STORE and FAS as well.
Since we already added add32 support, we need to define add64
here, but we haven't defined fas, load and store at all, so
we can fallback on default implementations.
*/
#define make_atomic_add_body64 \
int64 tmp=*a; \
while (!my_atomic_cas64(a, &tmp, tmp+v)); \
v=tmp;
/*
On some platforms (e.g. Mac OS X and Solaris) the ebx register
is held as a pointer to the global offset table. Thus we're not
allowed to use the b-register on those platforms when compiling
PIC code, to avoid this we push ebx and pop ebx and add a movl
instruction to avoid having ebx in the interface of the assembler
instruction.
cmpxchg8b works on both 32-bit platforms and 64-bit platforms but
the code here is only used on 32-bit platforms, on 64-bit
platforms the much simpler make_atomic_cas_body32 will work
fine.
*/
#define make_atomic_cas_body64 \
int32 ebx=(set & 0xFFFFFFFF), ecx=(set >> 32); \
asm volatile ("push %%ebx; movl %3, %%ebx;" \
LOCK_prefix "; cmpxchg8b %0; setz %2; pop %%ebx"\
: "+m" (*a), "+A" (*cmp), "=q" (ret) \
:"m" (ebx), "c" (ecx))
#endif
/*
The implementation of make_atomic_cas_body32 is adaptable to
the OS word size, so on 64-bit platforms it will automatically
adapt to 64-bits and so it will work also on 64-bit platforms
*/
#define make_atomic_cas_bodyptr make_atomic_cas_body32
#ifdef MY_ATOMIC_MODE_DUMMY
#define make_atomic_load_body(S) ret=*a
#define make_atomic_store_body(S) *a=v
#endif
#endif /* ATOMIC_X86_GCC_INCLUDED */

View file

@ -30,6 +30,7 @@ extern "C" {
/* flags for hash_init */
#define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */
typedef uint my_hash_value_type;
typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool);
typedef void (*my_hash_free_key)(void *);
@ -60,8 +61,18 @@ void my_hash_free(HASH *tree);
void my_hash_reset(HASH *hash);
uchar *my_hash_element(HASH *hash, ulong idx);
uchar *my_hash_search(const HASH *info, const uchar *key, size_t length);
uchar *my_hash_search_using_hash_value(const HASH *info,
my_hash_value_type hash_value,
const uchar *key, size_t length);
my_hash_value_type my_calc_hash(const HASH *info,
const uchar *key, size_t length);
uchar *my_hash_first(const HASH *info, const uchar *key, size_t length,
HASH_SEARCH_STATE *state);
uchar *my_hash_first_from_hash_value(const HASH *info,
my_hash_value_type hash_value,
const uchar *key,
size_t length,
HASH_SEARCH_STATE *state);
uchar *my_hash_next(const HASH *info, const uchar *key, size_t length,
HASH_SEARCH_STATE *state);
my_bool my_hash_insert(HASH *info, const uchar *data);

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2003 MySQL AB
/* Copyright (C) 2003 MySQL AB, 2009 Sun Microsystems, Inc
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -70,7 +70,7 @@ typedef struct st_key_cache
uchar HUGE_PTR *block_mem; /* memory for block buffers */
BLOCK_LINK *used_last; /* ptr to the last block of the LRU chain */
BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */
pthread_mutex_t cache_lock; /* to lock access to the cache structure */
mysql_mutex_t cache_lock; /* to lock access to the cache structure */
KEYCACHE_WQUEUE resize_queue; /* threads waiting during resize operation */
/*
Waiting for a zero resize count. Using a queue for symmetry though

View file

@ -37,7 +37,7 @@
my_atomic_store#(&var, what)
store 'what' in *var
'#' is substituted by a size suffix - 8, 16, 32, or ptr
'#' is substituted by a size suffix - 8, 16, 32, 64, or ptr
(e.g. my_atomic_add8, my_atomic_fas32, my_atomic_casptr).
NOTE This operations are not always atomic, so they always must be
@ -49,18 +49,17 @@
On architectures where these operations are really atomic, rwlocks will
be optimized away.
8- and 16-bit atomics aren't implemented for windows (see generic-msvc.h),
but can be added, if necessary.
but can be added, if necessary.
*/
#ifndef my_atomic_rwlock_init
#define intptr void *
/**
On most platforms we implement 8-bit, 16-bit, 32-bit and "pointer"
operations. Thus the symbol below is defined by default; platforms
where we leave out 8-bit or 16-bit operations should undefine it.
Currently we don't support 8-bit and 16-bit operations.
It can be added later if needed.
*/
#define MY_ATOMIC_HAS_8_16 1
#undef MY_ATOMIC_HAS_8_16
#ifndef MY_ATOMIC_MODE_RWLOCKS
/*
@ -69,10 +68,12 @@
#include "atomic/nolock.h"
#endif
#ifndef make_atomic_cas_body
#ifndef MY_ATOMIC_NOLOCK
/* nolock.h was not able to generate even a CAS function, fall back */
#include "atomic/rwlock.h"
#else
#endif
#ifndef MY_ATOMICS_MADE
/* define missing functions by using the already generated ones */
#ifndef make_atomic_add_body
#define make_atomic_add_body(S) \
@ -95,7 +96,6 @@
#define make_atomic_store_body(S) \
(void)(my_atomic_fas ## S (a, v));
#endif
#endif
/*
transparent_union doesn't work in g++
@ -129,6 +129,7 @@
make_transparent_unions(8)
make_transparent_unions(16)
make_transparent_unions(32)
make_transparent_unions(64)
make_transparent_unions(ptr)
#undef uintptr
#undef make_transparent_unions
@ -140,10 +141,12 @@ make_transparent_unions(ptr)
#define U_8 int8
#define U_16 int16
#define U_32 int32
#define U_64 int64
#define U_ptr intptr
#define Uv_8 int8
#define Uv_16 int16
#define Uv_32 int32
#define Uv_64 int64
#define Uv_ptr intptr
#define U_a volatile *a
#define U_cmp *cmp
@ -217,6 +220,7 @@ make_atomic_cas(8)
make_atomic_cas(16)
#endif
make_atomic_cas(32)
make_atomic_cas(64)
make_atomic_cas(ptr)
#ifdef MY_ATOMIC_HAS_8_16
@ -224,12 +228,14 @@ make_atomic_add(8)
make_atomic_add(16)
#endif
make_atomic_add(32)
make_atomic_add(64)
#ifdef MY_ATOMIC_HAS_8_16
make_atomic_load(8)
make_atomic_load(16)
#endif
make_atomic_load(32)
make_atomic_load(64)
make_atomic_load(ptr)
#ifdef MY_ATOMIC_HAS_8_16
@ -237,6 +243,7 @@ make_atomic_fas(8)
make_atomic_fas(16)
#endif
make_atomic_fas(32)
make_atomic_fas(64)
make_atomic_fas(ptr)
#ifdef MY_ATOMIC_HAS_8_16
@ -244,6 +251,7 @@ make_atomic_store(8)
make_atomic_store(16)
#endif
make_atomic_store(32)
make_atomic_store(64)
make_atomic_store(ptr)
#ifdef _atomic_h_cleanup_
@ -254,10 +262,12 @@ make_atomic_store(ptr)
#undef U_8
#undef U_16
#undef U_32
#undef U_64
#undef U_ptr
#undef Uv_8
#undef Uv_16
#undef Uv_32
#undef Uv_64
#undef Uv_ptr
#undef a
#undef cmp
@ -277,6 +287,7 @@ make_atomic_store(ptr)
#undef make_atomic_load_body
#undef make_atomic_store_body
#undef make_atomic_fas_body
#endif
#undef intptr
/*

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB
/* Copyright (C) 2000 MySQL AB, 2009 Sun Microsystems, Inc
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
@ -34,7 +34,7 @@ typedef struct st_bitmap
acquiring the mutex
*/
#ifdef THREAD
pthread_mutex_t *mutex;
mysql_mutex_t *mutex;
#endif
} MY_BITMAP;

View file

@ -876,6 +876,8 @@ typedef SOCKET_SIZE_TYPE size_socket;
#endif
#endif /* defined (HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)*/
#define INT_MIN64 (~0x7FFFFFFFFFFFFFFFLL)
#define INT_MAX64 0x7FFFFFFFFFFFFFFFLL
#define INT_MIN32 (~0x7FFFFFFFL)
#define INT_MAX32 0x7FFFFFFFL
#define UINT_MAX32 0xFFFFFFFFL
@ -899,7 +901,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FLT_MAX ((float)3.40282346638528860e+38)
#endif
#ifndef SIZE_T_MAX
#define SIZE_T_MAX ~((size_t) 0)
#define SIZE_T_MAX (~((size_t) 0))
#endif
#ifndef isfinite

View file

@ -59,5 +59,13 @@
#define mysql_rwlock_unlock(A) do {} while (0)
#define mysql_rwlock_destroy(A) do {} while (0)
typedef int my_pthread_once_t;
#define MY_PTHREAD_ONCE_INIT 0
#define MY_PTHREAD_ONCE_DONE 1
#define my_pthread_once(C,F) do { \
if (*(C) != MY_PTHREAD_ONCE_DONE) { F(); *(C)= MY_PTHREAD_ONCE_DONE; } \
} while(0)
#endif
#endif /* MY_NO_PTHREAD_INCLUDED */

View file

@ -67,6 +67,11 @@ typedef int pthread_mutexattr_t;
#define pthread_handler_t EXTERNC void * __cdecl
typedef void * (__cdecl *pthread_handler)(void *);
typedef volatile LONG my_pthread_once_t;
#define MY_PTHREAD_ONCE_INIT 0
#define MY_PTHREAD_ONCE_INPROGRESS 1
#define MY_PTHREAD_ONCE_DONE 2
/*
Struct and macros to be used in combination with the
windows implementation of pthread_cond_timedwait
@ -110,6 +115,7 @@ int pthread_cond_destroy(pthread_cond_t *cond);
int pthread_attr_init(pthread_attr_t *connect_att);
int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack);
int pthread_attr_destroy(pthread_attr_t *connect_att);
int my_pthread_once(my_pthread_once_t *once_control,void (*init_routine)(void));
struct tm *localtime_r(const time_t *timep,struct tm *tmp);
struct tm *gmtime_r(const time_t *timep,struct tm *tmp);
@ -148,8 +154,6 @@ int pthread_join(pthread_t thread, void **value_ptr);
#define pthread_detach_this_thread()
#define pthread_condattr_init(A)
#define pthread_condattr_destroy(A)
#define pthread_yield() SwitchToThread()
/* per the platform's documentation */
#define pthread_yield() Sleep(0)
@ -186,6 +190,10 @@ void my_pthread_exit(void *status);
#define pthread_handler_t EXTERNC void *
typedef void *(* pthread_handler)(void *);
#define my_pthread_once_t pthread_once_t
#define MY_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
#define my_pthread_once(C,F) pthread_once(C,F)
/* Test first for RTS or FSU threads */
#if defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM)
@ -607,6 +615,8 @@ extern pthread_mutexattr_t my_errorcheck_mutexattr;
typedef ulong my_thread_id;
extern my_bool my_thread_global_init(void);
extern my_bool my_thread_basic_global_init(void);
extern void my_thread_basic_global_reinit(void);
extern void my_thread_global_end(void);
extern my_bool my_thread_init(void);
extern void my_thread_end(void);
@ -637,10 +647,10 @@ extern int pthread_dummy(int);
struct st_my_thread_var
{
int thr_errno;
pthread_cond_t suspend;
pthread_mutex_t mutex;
pthread_mutex_t * volatile current_mutex;
pthread_cond_t * volatile current_cond;
mysql_cond_t suspend;
mysql_mutex_t mutex;
mysql_mutex_t * volatile current_mutex;
mysql_cond_t * volatile current_cond;
pthread_t pthread_self;
my_thread_id id;
int cmp_length;
@ -692,16 +702,16 @@ extern uint thd_lib_detected;
#ifdef THREAD
#ifndef thread_safe_increment
#define thread_safe_increment(V,L) \
(pthread_mutex_lock((L)), (V)++, pthread_mutex_unlock((L)))
(mysql_mutex_lock((L)), (V)++, mysql_mutex_unlock((L)))
#define thread_safe_decrement(V,L) \
(pthread_mutex_lock((L)), (V)--, pthread_mutex_unlock((L)))
(mysql_mutex_lock((L)), (V)--, mysql_mutex_unlock((L)))
#endif
#ifndef thread_safe_add
#define thread_safe_add(V,C,L) \
(pthread_mutex_lock((L)), (V)+=(C), pthread_mutex_unlock((L)))
(mysql_mutex_lock((L)), (V)+=(C), mysql_mutex_unlock((L)))
#define thread_safe_sub(V,C,L) \
(pthread_mutex_lock((L)), (V)-=(C), pthread_mutex_unlock((L)))
(mysql_mutex_lock((L)), (V)-=(C), mysql_mutex_unlock((L)))
#endif
#endif

View file

@ -23,7 +23,7 @@
(defined(__alpha__) && defined(__GNUC__))
#define HAVE_STACKTRACE 1
#endif
#elif defined(__WIN__)
#elif defined(__WIN__) || defined(__sun)
#define HAVE_STACKTRACE 1
#endif

View file

@ -338,7 +338,7 @@ struct st_my_file_info
#endif
enum file_type type;
#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32)
pthread_mutex_t mutex;
mysql_mutex_t mutex;
#endif
};
@ -358,7 +358,7 @@ typedef struct st_my_tmpdir
char **list;
uint cur, max;
#ifdef THREAD
pthread_mutex_t mutex;
mysql_mutex_t mutex;
#endif
} MY_TMPDIR;
@ -374,9 +374,9 @@ typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
#ifdef THREAD
typedef struct st_io_cache_share
{
pthread_mutex_t mutex; /* To sync on reads into buffer. */
pthread_cond_t cond; /* To wait for signals. */
pthread_cond_t cond_writer; /* For a synchronized writer. */
mysql_mutex_t mutex; /* To sync on reads into buffer. */
mysql_cond_t cond; /* To wait for signals. */
mysql_cond_t cond_writer; /* For a synchronized writer. */
/* Offset in file corresponding to the first byte of buffer. */
my_off_t pos_in_file;
/* If a synchronized write cache is the source of the data. */
@ -437,7 +437,7 @@ typedef struct st_io_cache /* Used when cacheing files */
The lock is for append buffer used in SEQ_READ_APPEND cache
need mutex copying from append buffer to read buffer.
*/
pthread_mutex_t append_buffer_lock;
mysql_mutex_t append_buffer_lock;
/*
The following is used when several threads are reading the
same file in parallel. They are synchronized on disk
@ -691,6 +691,7 @@ extern const char **my_error_unregister(int first, int last);
extern void my_message(uint my_err, const char *str,myf MyFlags);
extern void my_message_no_curses(uint my_err, const char *str,myf MyFlags);
extern void my_message_curses(uint my_err, const char *str,myf MyFlags);
extern my_bool my_basic_init(void);
extern my_bool my_init(void);
extern void my_end(int infoflag);
extern int my_redel(const char *from, const char *to, int MyFlags);
@ -978,7 +979,6 @@ extern my_bool resolve_collation(const char *cl_name,
CHARSET_INFO *default_cl,
CHARSET_INFO **cl);
extern void free_charsets(void);
extern char *get_charsets_dir(char *buf);
extern my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2);
extern my_bool init_compiled_charsets(myf flags);

View file

@ -259,6 +259,8 @@ extern ulong myisam_bulk_insert_tree_size, myisam_data_pointer_size;
/* usually used to check if a symlink points into the mysql data home */
/* which is normally forbidden */
extern int (*myisam_test_invalid_symlink)(const char *filename);
extern ulonglong myisam_mmap_size, myisam_mmap_used;
extern mysql_mutex_t THR_LOCK_myisam_mmap;
/* Prototypes for myisam-functions */
@ -304,6 +306,7 @@ extern int mi_delete_all_rows(struct st_myisam_info *info);
extern ulong _mi_calc_blob_length(uint length , const uchar *pos);
extern uint mi_get_pointer_length(ulonglong file_length, uint def);
#define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for mmap file */
/* this is used to pass to mysql_myisamchk_table */
#define MYISAMCHK_REPAIR 1 /* equivalent to myisamchk -r */

View file

@ -1,4 +1,4 @@
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
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
@ -115,10 +115,11 @@ typedef struct st_thr_lock_data {
THR_LOCK_OWNER *owner;
struct st_thr_lock_data *next,**prev;
struct st_thr_lock *lock;
pthread_cond_t *cond;
mysql_cond_t *cond;
enum thr_lock_type type;
void *status_param; /* Param to status functions */
void *debug_print_param;
struct PSI_table *m_psi;
} THR_LOCK_DATA;
struct st_lock_list {
@ -127,7 +128,7 @@ struct st_lock_list {
typedef struct st_thr_lock {
LIST list;
pthread_mutex_t mutex;
mysql_mutex_t mutex;
struct st_lock_list read_wait;
struct st_lock_list read;
struct st_lock_list write_wait;
@ -144,7 +145,7 @@ typedef struct st_thr_lock {
extern LIST *thr_lock_thread_list;
extern pthread_mutex_t THR_LOCK_lock;
extern mysql_mutex_t THR_LOCK_lock;
my_bool init_thr_lock(void); /* Must be called once/thread */
#define thr_lock_owner_init(owner, info_arg) (owner)->info= (info_arg)

View file

@ -211,7 +211,6 @@ void STDCALL mysql_server_end()
}
else
{
free_charsets();
mysql_thread_end();
}

View file

@ -12,9 +12,7 @@ main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_m
main.lock_multi_bug38691 @solaris # Bug#47792 2009-10-02 alik main.lock_multi_bug38691 times out sporadically on Solaris 10
main.log_tables # Bug#47924 2009-10-08 alik main.log_tables times out sporadically
main.plugin # Bug#47146 Linking problem with example plugin when dtrace enabled
main.plugin_load # Bug#47146
rpl.rpl_cross_version* # Bug#48340 2009-12-01 Daogang rpl_cross_version: Found warnings/errors in server log file!
rpl.rpl_get_master_version_and_clock* # Bug#49191 2009-12-01 Daogang rpl_get_master_version_and_clock failed on PB2: COM_REGISTER_SLAVE failed
rpl.rpl_heartbeat_basic # BUG#43828 2009-10-22 luis fails sporadically
rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically

View file

@ -21,14 +21,26 @@ connection slave;
reset master;
connection master;
# MTR is not case-sensitive.
let $lower_stmt_head= load data;
let $UPPER_STMT_HEAD= LOAD DATA;
if (`SELECT '$lock_option' <> ''`)
{
#if $lock_option is null, an extra blank is added into the statement,
#this will change the result of rpl_loaddata test case. so $lock_option
#is set only when it is not null.
let $lower_stmt_head= load data $lock_option;
let $UPPER_STMT_HEAD= LOAD DATA $lock_option;
}
select last_insert_id();
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
# verify that LAST_INSERT_ID() is set by LOAD DATA INFILE
select last_insert_id();
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
@ -56,7 +68,7 @@ sync_with_master;
insert into t1 values(1,10);
connection master;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
@ -70,9 +82,11 @@ connection slave;
set global sql_slave_skip_counter=1;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--query_vertical show slave status;
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
echo Last_SQL_Errno=$last_error;
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
echo Last_SQL_Error;
echo $last_error;
# Trigger error again to test CHANGE MASTER
@ -80,7 +94,7 @@ connection master;
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
@ -92,9 +106,11 @@ connection slave;
stop slave;
change master to master_user='test';
change master to master_user='root';
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--query_vertical show slave status;
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
echo Last_SQL_Errno=$last_error;
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
echo Last_SQL_Error;
echo $last_error;
# Trigger error again to test RESET SLAVE
@ -105,7 +121,7 @@ connection master;
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
@ -114,9 +130,11 @@ connection slave;
# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
stop slave;
reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--query_vertical show slave status;
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
echo Last_SQL_Errno=$last_error;
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
echo Last_SQL_Error;
echo $last_error;
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
@ -125,7 +143,7 @@ reset master;
eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=$engine_type; # no transactions
--error ER_DUP_ENTRY
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
select * from t2;
@ -141,7 +159,7 @@ alter table t2 drop key day;
connection master;
delete from t2;
--error ER_DUP_ENTRY
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
connection slave;
@ -154,7 +172,7 @@ drop table t1, t2;
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
--error ER_DUP_ENTRY
LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
eval $UPPER_STMT_HEAD INFILE "../../std_data/words.dat" INTO TABLE t1;
DROP TABLE IF EXISTS t1;
@ -182,17 +200,17 @@ DROP TABLE IF EXISTS t1;
-- echo ### assertion: works with cross-referenced database
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
-- eval use $db1
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- echo ### assertion: works with fully qualified name on current database
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
-- echo ### assertion: works without fully qualified name on current database
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1
-- echo ### create connection without default database
-- echo ### connect (conn2,localhost,root,,*NO-ONE*);
@ -200,7 +218,7 @@ connect (conn2,localhost,root,,*NO-ONE*);
-- connection conn2
-- echo ### assertion: works without stating the default database
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
-- echo ### disconnect and switch back to master connection
-- disconnect conn2
-- connection master

View file

@ -0,0 +1,6 @@
# include file for checking if variable key_reads is zero
let $key_reads= query_get_value(SHOW STATUS LIKE 'key_reads',Value,1);
--disable_query_log
eval SELECT IF($key_reads = 0, "Yes!", "No!") as 'Zero key reads?';
FLUSH STATUS;
--enable_query_log

View file

@ -0,0 +1,9 @@
# include file for checking if variable key_reads = key_read_requests
let $key_reads= query_get_value(SHOW STATUS LIKE 'key_reads',Value,1);
let $key_r_req= query_get_value(SHOW STATUS LIKE 'key_read_requests',Value,1);
let $key_writes= query_get_value(SHOW STATUS LIKE 'key_writes',Value,1);
let $key_w_req= query_get_value(SHOW STATUS LIKE 'key_write_requests',Value,1);
--disable_query_log
eval SELECT IF($key_reads = $key_r_req, "reads == requests", "reads != requests") as 'reads vs requests';
eval SELECT IF($key_writes = $key_w_req, "writes == requests", "writes != requests") as 'writes vs requests';
--enable_query_log

View file

@ -52,7 +52,7 @@ if (`SELECT '$debug_lock' != ''`)
# reap the result of the waiting query
connection $connection_name;
error 0, 1317, 1307, 1306, 1334, 1305;
error 0, 1317, 1307, 1306, 1334, 1305, 1034;
reap;
connection master;

View file

@ -116,6 +116,26 @@ select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a'
1 1 1
SET CHARACTER SET koi8r;
create table t1 (a varchar(2) character set ucs2 collate ucs2_bin, key(a));
insert into t1 values ('A'),('A'),('B'),('C'),('D'),('A\t');
insert into t1 values ('A\0'),('A\0'),('A\0'),('A\0'),('AZ');
select hex(a) from t1 where a like 'A_' order by a;
hex(a)
00410000
00410000
00410000
00410000
00410009
0041005A
select hex(a) from t1 ignore key(a) where a like 'A_' order by a;
hex(a)
00410000
00410000
00410000
00410000
00410009
0041005A
drop table t1;
CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2, word2 CHAR(64) CHARACTER SET ucs2);
INSERT INTO t1 VALUES (_koi8r'ò',_koi8r'ò'), (X'2004',X'2004');
SELECT hex(word) FROM t1 ORDER BY word;

View file

@ -1848,6 +1848,24 @@ select hex(_utf8 B'001111111111');
ERROR HY000: Invalid utf8 character string: 'FF'
select (_utf8 X'616263FF');
ERROR HY000: Invalid utf8 character string: 'FF'
#
# Bug#44131 Binary-mode "order by" returns records in incorrect order for UTF-8 strings
#
CREATE TABLE t1 (id int not null primary key, name varchar(10)) character set utf8;
INSERT INTO t1 VALUES
(2,'一二三01'),(3,'一二三09'),(4,'一二三02'),(5,'一二三08'),
(6,'一二三11'),(7,'一二三91'),(8,'一二三21'),(9,'一二三81');
SELECT * FROM t1 ORDER BY BINARY(name);
id name
2 一二三01
4 一二三02
5 一二三08
3 一二三09
6 一二三11
8 一二三21
9 一二三81
7 一二三91
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;

View file

@ -1,8 +0,0 @@
drop database if exists events_test;
drop database if exists events_test2;
drop table if exists t1;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
) ENGINE=example;
drop table t1;

View file

@ -560,6 +560,20 @@ MATCH (col) AGAINST('findme')
DEALLOCATE PREPARE s;
DROP TABLE t1;
#
# Bug #49250 : spatial btree index corruption and crash
# Part two : fulltext syntax check
#
CREATE TABLE t1(col1 TEXT,
FULLTEXT INDEX USING BTREE (col1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE (col1))' at line 2
CREATE TABLE t2(col1 TEXT);
CREATE FULLTEXT INDEX USING BTREE ON t2(col);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE ON t2(col)' at line 1
ALTER TABLE t2 ADD FULLTEXT INDEX USING BTREE (col1);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE (col1)' at line 1
DROP TABLE t2;
End of 5.0 tests
#
# Bug #47930: MATCH IN BOOLEAN MODE returns too many results
# inside subquery
#

View file

@ -2561,6 +2561,35 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using join buffer
2 DERIVED t1 ALL NULL NULL NULL NULL 2
drop table t1;
#
# Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0
#
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a VARCHAR(20), b INT);
CREATE TABLE t2 (a VARCHAR(20), b INT);
INSERT INTO t1 VALUES ('ABC', 1);
INSERT INTO t2 VALUES ('ABC', 1);
SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a)
FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b;
DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a)
secret
SELECT DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a)
FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b;
DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a)
secret
SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC')
FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b;
DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC')
secret
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
INSERT INTO t1 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1);
INSERT INTO t2 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1);
SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a)
FROM t2 WHERE t2.b = 1 GROUP BY t2.b;
DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a)
secret
DROP TABLE t1, t2;
Start of 5.4 tests
SELECT format(12345678901234567890.123, 3);
format(12345678901234567890.123, 3)

View file

@ -984,6 +984,19 @@ GEOMFROMTEXT(
SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
1
DROP TABLE t1;
#
# Bug #49250 : spatial btree index corruption and crash
# Part one : spatial syntax check
#
CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL,
SPATIAL INDEX USING BTREE (col1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE (col1))' at line 2
CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL);
CREATE SPATIAL INDEX USING BTREE ON t2(col);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE ON t2(col)' at line 1
ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE (col1)' at line 1
DROP TABLE t2;
End of 5.0 tests
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create view v1 as select * from t1;

View file

@ -1258,3 +1258,38 @@ SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL;
c e d
1 0 NULL
DROP TABLE t1,t2;
#
# Bug#47650: using group by with rollup without indexes returns incorrect
# results with where
#
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 ( a INT, b INT );
INSERT INTO t2 VALUES (1, 1),(1, 2),(1, 3),(2, 4),(2, 5);
EXPLAIN
SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
FROM t1 LEFT JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 5
SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
FROM t1 LEFT JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
a COUNT( t2.b ) SUM( t2.b ) MAX( t2.b )
1 3 6 3
NULL 3 6 3
EXPLAIN
SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
FROM t1 JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using where
SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
FROM t1 JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
a COUNT( t2.b ) SUM( t2.b ) MAX( t2.b )
1 3 6 3
NULL 3 6 3
DROP TABLE t1, t2;

View file

@ -1855,6 +1855,21 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
#
# Bug #49465: valgrind warnings and incorrect live checksum...
#
CREATE TABLE t1(
a VARCHAR(1), b VARCHAR(1), c VARCHAR(1),
f VARCHAR(1), g VARCHAR(1), h VARCHAR(1),
i VARCHAR(1), j VARCHAR(1), k VARCHAR(1)) CHECKSUM=1;
INSERT INTO t1 VALUES('', '', '', '', '', '', '', '', '');
CHECKSUM TABLE t1 QUICK;
Table Checksum
test.t1 467455460
CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 467455460
DROP TABLE t1;
End of 5.0 tests
create table t1 (a int not null, key `a` (a) key_block_size=1024);
show create table t1;

View file

@ -127,4 +127,46 @@ mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
set GLOBAL sql_mode=default;
#
# Bug #41569 mysql_upgrade (ver 5.1) add 3 fields to mysql.proc table
# but does not set values.
#
CREATE PROCEDURE testproc() BEGIN END;
UPDATE mysql.proc SET character_set_client = NULL WHERE name LIKE 'testproc';
UPDATE mysql.proc SET collation_connection = NULL WHERE name LIKE 'testproc';
UPDATE mysql.proc SET db_collation = NULL WHERE name LIKE 'testproc';
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log
Error : You can't use locks with log tables.
status : OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers OK
mysql.slow_log
Error : You can't use locks with log tables.
status : OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
CALL testproc();
DROP PROCEDURE testproc;
WARNING: NULL values of the 'character_set_client' column ('mysql.proc' table) have been updated with a default value (latin1). Please verify if necessary.
WARNING: NULL values of the 'collation_connection' column ('mysql.proc' table) have been updated with a default value (latin1_swedish_ci). Please verify if necessary.
WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been updated with default values. Please verify if necessary.
The --upgrade-system-tables option was used, databases won't be touched.

View file

@ -1463,6 +1463,15 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
col
1
# Must use ref-or-null on the a_c index
EXPLAIN
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC;
id select_type table type possible_keys key key_len ref rows Extra
x x x ref_or_null a_c,a x x x x x
# Must return 1 row
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC;
col
1
DROP TABLE t1;
End of 5.0 tests
CREATE TABLE t2 (a varchar(32), b int(11), c float, d double,

View file

@ -24,8 +24,8 @@ a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
b varchar(10),
PRIMARY KEY (a)
)
PARTITION BY RANGE (to_days(a)) (
PARTITION p1 VALUES LESS THAN (733407),
PARTITION BY RANGE (UNIX_TIMESTAMP(a)) (
PARTITION p1 VALUES LESS THAN (1199134800),
PARTITION pmax VALUES LESS THAN MAXVALUE
);
INSERT INTO t1 VALUES ('2007-07-30 17:35:48', 'p1');
@ -37,7 +37,7 @@ a b
2009-07-14 17:35:55 pmax
2009-09-21 17:31:42 pmax
ALTER TABLE t1 REORGANIZE PARTITION pmax INTO (
PARTITION p3 VALUES LESS THAN (733969),
PARTITION p3 VALUES LESS THAN (1247688000),
PARTITION pmax VALUES LESS THAN MAXVALUE);
SELECT * FROM t1;
a b
@ -51,9 +51,9 @@ t1 CREATE TABLE `t1` (
`b` varchar(10) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (to_days(a))
(PARTITION p1 VALUES LESS THAN (733407) ENGINE = MyISAM,
PARTITION p3 VALUES LESS THAN (733969) ENGINE = MyISAM,
/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
(PARTITION p1 VALUES LESS THAN (1199134800) ENGINE = MyISAM,
PARTITION p3 VALUES LESS THAN (1247688000) ENGINE = MyISAM,
PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
DROP TABLE t1;
create table t1 (a int NOT NULL, b varchar(5) NOT NULL)

View file

@ -126,7 +126,7 @@ ERROR HY000: This partition function is not allowed
create table t1 (col1 date)
partition by range(unix_timestamp(col1))
(partition p0 values less than (10), partition p1 values less than (30));
ERROR HY000: This partition function is not allowed
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
create table t1 (col1 datetime)
partition by range(week(col1))
(partition p0 values less than (10), partition p1 values less than (30));

View file

@ -9,6 +9,30 @@ partition by range columns (a,b,c)
( partition p0 values less than (1, maxvalue, 10),
partition p1 values less than (1, maxvalue, maxvalue));
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
create table t1 (a varchar(5) character set ucs2 collate ucs2_bin)
partition by range columns (a)
(partition p0 values less than (0x0041));
insert into t1 values (0x00410000);
select hex(a) from t1 where a like 'A_';
hex(a)
00410000
explain partitions select hex(a) from t1 where a like 'A_';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
alter table t1 remove partitioning;
select hex(a) from t1 where a like 'A_';
hex(a)
00410000
create index a on t1 (a);
select hex(a) from t1 where a like 'A_';
hex(a)
00410000
insert into t1 values ('A_');
select hex(a) from t1;
hex(a)
00410000
0041005F
drop table t1;
create table t1 (a varchar(1) character set latin1 collate latin1_general_ci)
partition by range columns(a)
( partition p0 values less than ('a'),
@ -69,7 +93,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST COLUMNS(a)
/*!50500 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN ('''') ENGINE = MyISAM,
PARTITION p1 VALUES IN ('\\') ENGINE = MyISAM,
PARTITION p2 VALUES IN ('\0') ENGINE = MyISAM) */
@ -128,7 +152,7 @@ t1 CREATE TABLE `t1` (
`c` varchar(25) DEFAULT NULL,
`d` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE COLUMNS(a,b,c,d)
/*!50500 PARTITION BY RANGE COLUMNS(a,b,c,d)
SUBPARTITION BY HASH (to_seconds(d))
SUBPARTITIONS 4
(PARTITION p0 VALUES LESS THAN (1,'0',MAXVALUE,'1900-01-01') ENGINE = MyISAM,
@ -211,7 +235,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST COLUMNS(a,b)
/*!50500 PARTITION BY LIST COLUMNS(a,b)
(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) */
@ -245,7 +269,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST COLUMNS(a,b)
/*!50500 PARTITION BY LIST COLUMNS(a,b)
(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) */
@ -299,7 +323,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST COLUMNS(a)
/*!50500 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM,
PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) */
insert into t1 values (1);
@ -314,7 +338,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST COLUMNS(a)
/*!50500 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM,
PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) */
drop table t1;
@ -349,7 +373,7 @@ t1 CREATE TABLE `t1` (
`c` varchar(5) DEFAULT NULL,
`d` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE COLUMNS(a,b,c)
/*!50500 PARTITION BY RANGE COLUMNS(a,b,c)
SUBPARTITION BY KEY (c,d)
SUBPARTITIONS 3
(PARTITION p0 VALUES LESS THAN (1,'abc','abc') ENGINE = MyISAM,
@ -382,7 +406,7 @@ t1 CREATE TABLE `t1` (
`b` varchar(2) DEFAULT NULL,
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE COLUMNS(a,b,c)
/*!50500 PARTITION BY RANGE COLUMNS(a,b,c)
(PARTITION p0 VALUES LESS THAN (1,'A',1) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (1,'B',1) ENGINE = MyISAM) */
insert into t1 values (1, 'A', 1);

View file

@ -138,7 +138,7 @@ primary key(a,b))
partition by hash (rand(a))
partitions 2
(partition x1, partition x2);
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
partitions 2
(partition x1, partition x2)' at line 6
CREATE TABLE t1 (
@ -149,7 +149,7 @@ primary key(a,b))
partition by range (rand(a))
partitions 2
(partition x1 values less than (0), partition x2 values less than (2));
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
partitions 2
(partition x1 values less than (0), partition x2 values less than' at line 6
CREATE TABLE t1 (
@ -160,7 +160,7 @@ primary key(a,b))
partition by list (rand(a))
partitions 2
(partition x1 values in (1), partition x2 values in (2));
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
partitions 2
(partition x1 values in (1), partition x2 values in (2))' at line 6
CREATE TABLE t1 (
@ -275,7 +275,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by hash (rand(a+b));
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 7
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 7
CREATE TABLE t1 (
a int not null,
b int not null,
@ -371,7 +371,7 @@ partition by range (3+4)
partitions 2
(partition x1 values less than (4) tablespace ts1,
partition x2 values less than (8) tablespace ts2);
ERROR HY000: Constant/Random expression in (sub)partitioning function is not allowed
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (
a int not null,
b int not null,
@ -540,7 +540,7 @@ partition by list (3+4)
partitions 2
(partition x1 values in (4) tablespace ts1,
partition x2 values in (8) tablespace ts2);
ERROR HY000: Constant/Random expression in (sub)partitioning function is not allowed
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (
a int not null,
b int not null,
@ -631,13 +631,13 @@ partition by range (ascii(v))
ERROR HY000: This partition function is not allowed
create table t1 (a int)
partition by hash (rand(a));
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
create table t1 (a int)
partition by hash(CURTIME() + a);
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
create table t1 (a int)
partition by hash (NOW()+a);
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
create table t1 (a int)
partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00')));
ERROR HY000: This partition function is not allowed
@ -648,3 +648,295 @@ ERROR HY000: This partition function is not allowed
create table t1 (a char(10))
partition by hash (extractvalue(a,'a'));
ERROR HY000: This partition function is not allowed
#
# Bug #42849: innodb crash with varying time_zone on partitioned
# timestamp primary key
#
CREATE TABLE old (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (UNIX_TIMESTAMP(a)) (
PARTITION p VALUES LESS THAN (1219089600),
PARTITION pmax VALUES LESS THAN MAXVALUE);
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: The PARTITION function returns the wrong type
ALTER TABLE old
PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: The PARTITION function returns the wrong type
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a+0) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (a+0) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a % 2) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (a % 2) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (ABS(a)) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (ABS(a)) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (CEILING(a)) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (CEILING(a)) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (FLOOR(a)) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (FLOOR(a)) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (TO_DAYS(a)) (
PARTITION p VALUES LESS THAN (733638),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (TO_DAYS(a)) (
PARTITION p VALUES LESS THAN (733638),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (DAYOFYEAR(a)) (
PARTITION p VALUES LESS THAN (231),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (DAYOFYEAR(a)) (
PARTITION p VALUES LESS THAN (231),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (DAYOFMONTH(a)) (
PARTITION p VALUES LESS THAN (19),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (DAYOFMONTH(a)) (
PARTITION p VALUES LESS THAN (19),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (DAYOFWEEK(a)) (
PARTITION p VALUES LESS THAN (3),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (DAYOFWEEK(a)) (
PARTITION p VALUES LESS THAN (3),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (MONTH(a)) (
PARTITION p VALUES LESS THAN (8),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (MONTH(a)) (
PARTITION p VALUES LESS THAN (8),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (HOUR(a)) (
PARTITION p VALUES LESS THAN (17),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (HOUR(a)) (
PARTITION p VALUES LESS THAN (17),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (MINUTE(a)) (
PARTITION p VALUES LESS THAN (55),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (MINUTE(a)) (
PARTITION p VALUES LESS THAN (55),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (QUARTER(a)) (
PARTITION p VALUES LESS THAN (3),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (QUARTER(a)) (
PARTITION p VALUES LESS THAN (3),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (SECOND(a)) (
PARTITION p VALUES LESS THAN (7),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (SECOND(a)) (
PARTITION p VALUES LESS THAN (7),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (YEARWEEK(a)) (
PARTITION p VALUES LESS THAN (200833),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (YEARWEEK(a)) (
PARTITION p VALUES LESS THAN (200833),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (YEAR(a)) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (YEAR(a)) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (WEEKDAY(a)) (
PARTITION p VALUES LESS THAN (3),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (WEEKDAY(a)) (
PARTITION p VALUES LESS THAN (3),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (TIME_TO_SEC(a)) (
PARTITION p VALUES LESS THAN (64507),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (TIME_TO_SEC(a)) (
PARTITION p VALUES LESS THAN (64507),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (EXTRACT(DAY FROM a)) (
PARTITION p VALUES LESS THAN (18),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (EXTRACT(DAY FROM a)) (
PARTITION p VALUES LESS THAN (18),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL, b TIMESTAMP NOT NULL, PRIMARY KEY(a,b))
PARTITION BY RANGE (DATEDIFF(a, a)) (
PARTITION p VALUES LESS THAN (18),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (DATEDIFF(a, a)) (
PARTITION p VALUES LESS THAN (18),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (YEAR(a + 0)) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (YEAR(a + 0)) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (TO_DAYS(a + '2008-01-01')) (
PARTITION p VALUES LESS THAN (733638),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (TO_DAYS(a + '2008-01-01')) (
PARTITION p VALUES LESS THAN (733638),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (YEAR(a + '2008-01-01')) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (YEAR(a + '2008-01-01')) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old ADD COLUMN b DATE;
CREATE TABLE new (a TIMESTAMP, b DATE)
PARTITION BY RANGE (YEAR(a + b)) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (YEAR(a + b)) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP, b DATE)
PARTITION BY RANGE (TO_DAYS(a + b)) (
PARTITION p VALUES LESS THAN (733638),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (TO_DAYS(a + b)) (
PARTITION p VALUES LESS THAN (733638),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP, b date)
PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
PARTITION p VALUES LESS THAN (1219089600),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old
PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
PARTITION p VALUES LESS THAN (1219089600),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE new (a TIMESTAMP, b TIMESTAMP)
PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
PARTITION p VALUES LESS THAN (1219089600),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE old MODIFY b TIMESTAMP;
ALTER TABLE old
PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
PARTITION p VALUES LESS THAN (1219089600),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
DROP TABLE old;
End of 5.1 tests

View file

@ -0,0 +1,417 @@
DROP TABLE IF EXISTS t1, t2, v, x;
# Actual test of key caches
# Verifing that reads/writes use the key cache correctly
SELECT @org_key_cache_buffer_size:= @@global.default.key_buffer_size;
@org_key_cache_buffer_size:= @@global.default.key_buffer_size
1048576
# Minimize default key cache (almost disabled).
SET @@global.default.key_buffer_size = 1;
Warnings:
Warning 1292 Truncated incorrect key_buffer_size value: '1'
CREATE TABLE t1 (
a INT,
b INT,
c INT NOT NULL,
PRIMARY KEY (a),
KEY `inx_b` (b))
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION p0 VALUES LESS THAN (1167602410)
(SUBPARTITION sp0,
SUBPARTITION sp1),
PARTITION p1 VALUES LESS THAN MAXVALUE
(SUBPARTITION sp2,
SUBPARTITION sp3));
CREATE TABLE t2 (
a INT,
b INT,
c INT NOT NULL,
PRIMARY KEY (a),
KEY `inx_b` (b));
FLUSH TABLES;
FLUSH STATUS;
SET @a:=1167602400;
CREATE VIEW v AS SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4;
CREATE VIEW x AS SELECT 1 FROM v,v a,v b;
FLUSH STATUS;
INSERT t1 SELECT @a, @a * (1 - ((@a % 2) * 2)) , 1167612400 - (@a:=@a+1) FROM x, x y;
reads vs requests
reads == requests
writes vs requests
writes == requests
# row distribution:
SELECT PARTITION_NAME, SUBPARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA='test' and TABLE_NAME='t1';
PARTITION_NAME SUBPARTITION_NAME TABLE_ROWS
p0 sp0 5
p0 sp1 5
p1 sp2 2043
p1 sp3 2043
DROP VIEW x;
DROP VIEW v;
FLUSH TABLES;
FLUSH STATUS;
SELECT COUNT(b) FROM t1 WHERE b >= 0;
COUNT(b)
2048
Zero key reads?
No!
INSERT t2 SELECT a,b,c FROM t1;
reads vs requests
reads == requests
writes vs requests
writes == requests
FLUSH STATUS;
SELECT COUNT(b) FROM t2 WHERE b >= 0;
COUNT(b)
2048
Zero key reads?
No!
FLUSH TABLES;
# Setting the default key cache to 1M
SET GLOBAL key_buffer_size = 1024*1024;
FLUSH STATUS;
# All these have to read the indexes
LOAD INDEX INTO CACHE t1 PARTITION (p1);
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
Zero key reads?
No!
SELECT COUNT(b) FROM t1 WHERE b >= 0;
COUNT(b)
2048
Zero key reads?
No!
SELECT COUNT(b) FROM t2 WHERE b >= 0;
COUNT(b)
2048
Zero key reads?
No!
# All these should be able to use the key cache
SELECT COUNT(b) FROM t1 WHERE b >= 0;
COUNT(b)
2048
Zero key reads?
Yes!
SELECT COUNT(b) FROM t2 WHERE b >= 0;
COUNT(b)
2048
Zero key reads?
Yes!
FLUSH TABLES;
LOAD INDEX INTO CACHE t1 PARTITION (p1,p0);
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
Zero key reads?
No!
# should not be zero
SELECT COUNT(b) FROM t1 WHERE b >= 0;
COUNT(b)
2048
Zero key reads?
Yes!
LOAD INDEX INTO CACHE t2;
Table Op Msg_type Msg_text
test.t2 preload_keys status OK
Zero key reads?
No!
# should not be zero
SELECT COUNT(b) FROM t2 WHERE b >= 0;
COUNT(b)
2048
Zero key reads?
Yes!
FLUSH TABLES;
LOAD INDEX INTO CACHE t1 PARTITION (p1,p0) IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
Zero key reads?
No!
# should not be zero
SELECT COUNT(b) FROM t1 WHERE b >= 0;
COUNT(b)
2048
Zero key reads?
No!
LOAD INDEX INTO CACHE t2 IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t2 preload_keys status OK
Zero key reads?
No!
# should not be zero
SELECT COUNT(b) FROM t2 WHERE b >= 0;
COUNT(b)
2048
Zero key reads?
No!
TRUNCATE TABLE t2;
INSERT t2 SELECT a,b,c FROM t1;
reads vs requests
reads != requests
writes vs requests
writes != requests
DROP TABLE t1,t2;
SET GLOBAL hot_cache.key_buffer_size = 1024*1024;
SET GLOBAL warm_cache.key_buffer_size = 1024*1024;
SET @@global.cold_cache.key_buffer_size = 1024*1024;
SELECT @@global.default.key_buffer_size a, @@global.default.key_cache_block_size b, @@global.default.key_cache_age_threshold c, @@global.default.key_cache_division_limit d;
a b c d
1048576 1024 300 100
SELECT @@global.hot_cache.key_buffer_size a, @@global.hot_cache.key_cache_block_size b, @@global.hot_cache.key_cache_age_threshold c, @@global.hot_cache.key_cache_division_limit d;
a b c d
1048576 1024 300 100
SELECT @@global.warm_cache.key_buffer_size a, @@global.warm_cache.key_cache_block_size b, @@global.warm_cache.key_cache_age_threshold c, @@global.warm_cache.key_cache_division_limit d;
a b c d
1048576 1024 300 100
SELECT @@global.cold_cache.key_buffer_size a, @@global.cold_cache.key_cache_block_size b, @@global.cold_cache.key_cache_age_threshold c, @@global.cold_cache.key_cache_division_limit d;
a b c d
1048576 1024 300 100
CREATE TABLE t1 (
a INT,
b VARCHAR(257),
c INT NOT NULL,
PRIMARY KEY (a),
KEY `inx_b` (b),
KEY `inx_c`(c))
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION p0 VALUES LESS THAN (10)
(SUBPARTITION sp0,
SUBPARTITION sp1),
PARTITION p1 VALUES LESS THAN MAXVALUE
(SUBPARTITION sp2,
SUBPARTITION sp3));
CREATE TABLE t2 (
a INT,
b VARCHAR(257),
c INT NOT NULL,
PRIMARY KEY (a),
KEY `inx_b` (b),
KEY `inx_c`(c));
SET @a:=1167602400;
CREATE VIEW v AS SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4;
CREATE VIEW x AS SELECT 1 FROM v,v a,v b;
INSERT t1 SELECT @a, CONCAT('X_', @a, ' MySQL'), 1167612400 - (@a:=@a+1) FROM x, x a;
DROP VIEW x;
DROP VIEW v;
INSERT t2 SELECT a, b, c FROM t1;
SELECT COUNT(*) FROM t1;
COUNT(*)
4096
SELECT COUNT(*) FROM t2;
COUNT(*)
4096
FLUSH TABLES;
# Restrict partitioned commands to partitioned tables only
CACHE INDEX t2 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
ERROR HY000: Partition management on a not partitioned table is not possible
CACHE INDEX t2 PARTITION (p0,`p1`) INDEX (`PRIMARY`) IN hot_cache;
ERROR HY000: Partition management on a not partitioned table is not possible
CACHE INDEX t2 PARTITION (`p1`) INDEX (`PRIMARY`,`inx_b`) IN hot_cache;
ERROR HY000: Partition management on a not partitioned table is not possible
CACHE INDEX t2 PARTITION (ALL) KEY (`inx_b`,`PRIMARY`) IN hot_cache;
ERROR HY000: Partition management on a not partitioned table is not possible
# Basic key cache testing
# The manual correctly says: "The syntax of CACHE INDEX enables you to
# specify that only particular indexes from a table should be assigned
# to the cache. The current implementation assigns all the table's
# indexes to the cache, so there is no reason to specify anything
# other than the table name."
# So the most of the test only tests the syntax
CACHE INDEX t2 INDEX (`inx_b`) IN hot_cache;
Table Op Msg_type Msg_text
test.t2 assign_to_keycache status OK
CACHE INDEX t2 KEY (`PRIMARY`) IN warm_cache;
Table Op Msg_type Msg_text
test.t2 assign_to_keycache status OK
CACHE INDEX t2 KEY (`PRIMARY`,`inx_b`) IN cold_cache;
Table Op Msg_type Msg_text
test.t2 assign_to_keycache status OK
CACHE INDEX t2 INDEX (inx_b,`PRIMARY`) IN default;
Table Op Msg_type Msg_text
test.t2 assign_to_keycache status OK
CACHE INDEX t1 PARTITION (p0) KEY (`inx_b`) IN cold_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
CACHE INDEX t1 PARTITIONS (p0) KEY (`inx_b`) IN cold_cache;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PARTITIONS (p0) KEY (`inx_b`) IN cold_cache' at line 1
# only one table at a time if specifying partitions
CACHE INDEX t1,t2 PARTITION (p0) KEY (`inx_b`) IN cold_cache;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PARTITION (p0) KEY (`inx_b`) IN cold_cache' at line 1
CACHE INDEX t1 PARTITION (`p0`,p1) INDEX (`PRIMARY`) IN warm_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
CACHE INDEX t1 PARTITION (`p1`) INDEX (`PRIMARY`,inx_b) IN hot_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
CACHE INDEX t1 PARTITION (ALL) KEY (`inx_b`,`PRIMARY`) IN default;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
CACHE INDEX t1 PARTITION (ALL) IN hot_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
CACHE INDEX t1 INDEX (`inx_b`) IN default;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
CACHE INDEX t1 KEY (`PRIMARY`) IN hot_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
CACHE INDEX t1 KEY (`PRIMARY`,`inx_b`) IN warm_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
CACHE INDEX t1 INDEX (`inx_b`,`PRIMARY`) IN cold_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
CACHE INDEX t1 IN hot_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
# Test of non existent key cache:
CACHE INDEX t1 IN non_existent_key_cache;
ERROR HY000: Unknown key cache 'non_existent_key_cache'
# Basic testing of LOAD INDEX
LOAD INDEX INTO CACHE t2;
Table Op Msg_type Msg_text
test.t2 preload_keys status OK
# PRIMARY and secondary keys have different block sizes
LOAD INDEX INTO CACHE t2 ignore leaves;
Table Op Msg_type Msg_text
test.t2 preload_keys error Indexes use different block sizes
test.t2 preload_keys status Operation failed
# Must have INDEX or KEY before the index list
LOAD INDEX INTO CACHE t2 (`PRIMARY`);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(`PRIMARY`)' at line 1
# Test of IGNORE LEAVES
LOAD INDEX INTO CACHE t2 INDEX (`PRIMARY`);
Table Op Msg_type Msg_text
test.t2 preload_keys status OK
LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_b`) IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t2 preload_keys error Indexes use different block sizes
test.t2 preload_keys status Operation failed
CACHE INDEX t2 IN warm_cache;
Table Op Msg_type Msg_text
test.t2 assign_to_keycache status OK
CACHE INDEX t1 IN cold_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`) IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t2 preload_keys error Indexes use different block sizes
test.t2 preload_keys status Operation failed
CACHE INDEX t2 INDEX (`inx_b`, `inx_c`) IN hot_cache;
Table Op Msg_type Msg_text
test.t2 assign_to_keycache status OK
LOAD INDEX INTO CACHE t2 KEY (`inx_b`, `inx_c`) IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t2 preload_keys error Indexes use different block sizes
test.t2 preload_keys status Operation failed
CACHE INDEX t2 IN warm_cache;
Table Op Msg_type Msg_text
test.t2 assign_to_keycache status OK
CACHE INDEX t2 INDEX (`PRIMARY`, `inx_c`) IN hot_cache;
Table Op Msg_type Msg_text
test.t2 assign_to_keycache status OK
LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_c`) IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t2 preload_keys error Indexes use different block sizes
test.t2 preload_keys status Operation failed
CACHE INDEX t2 INDEX (`inx_b`,`PRIMARY`) IN default;
Table Op Msg_type Msg_text
test.t2 assign_to_keycache status OK
LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_b`);
Table Op Msg_type Msg_text
test.t2 preload_keys status OK
CACHE INDEX t2 IN default;
Table Op Msg_type Msg_text
test.t2 assign_to_keycache status OK
LOAD INDEX INTO CACHE t2 IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t2 preload_keys error Indexes use different block sizes
test.t2 preload_keys status Operation failed
LOAD INDEX INTO CACHE t2 PARTITION (p1) INDEX (`PRIMARY`);
ERROR HY000: Partition management on a not partitioned table is not possible
LOAD INDEX INTO CACHE t1, t2;
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
test.t2 preload_keys status OK
# only one table at a time if specifying partitions
LOAD INDEX INTO CACHE t1 PARTITION (p0), t2;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' t2' at line 1
LOAD INDEX INTO CACHE t1 IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t1 preload_keys error Indexes use different block sizes
test.t1 preload_keys error Subpartition sp2 returned error
test.t1 preload_keys status Operation failed
LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`);
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`,`inx_b`) IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t1 preload_keys error Indexes use different block sizes
test.t1 preload_keys error Subpartition sp2 returned error
test.t1 preload_keys status Operation failed
LOAD INDEX INTO CACHE t1 INDEX (`inx_b`) IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t1 preload_keys error Indexes use different block sizes
test.t1 preload_keys error Subpartition sp2 returned error
test.t1 preload_keys status Operation failed
LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`) IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t1 preload_keys error Indexes use different block sizes
test.t1 preload_keys error Subpartition sp2 returned error
test.t1 preload_keys status Operation failed
LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`,`inx_b`);
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
LOAD INDEX INTO CACHE t1 PARTITION (p1) INDEX (`PRIMARY`);
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
LOAD INDEX INTO CACHE t1 PARTITION (`p1`,p0) KEY (`PRIMARY`) IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t1 preload_keys error Indexes use different block sizes
test.t1 preload_keys error Subpartition sp2 returned error
test.t1 preload_keys status Operation failed
LOAD INDEX INTO CACHE t1 PARTITION (ALL);
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
LOAD INDEX INTO CACHE t1 PARTITIONS ALL;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PARTITIONS ALL' at line 1
LOAD INDEX INTO CACHE t1 PARTITION (p1,`p0`) IGNORE LEAVES;
Table Op Msg_type Msg_text
test.t1 preload_keys error Indexes use different block sizes
test.t1 preload_keys error Subpartition sp2 returned error
test.t1 preload_keys status Operation failed
DROP INDEX `inx_b` on t1;
DROP INDEX `inx_b` on t2;
CACHE INDEX t2 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
ERROR HY000: Partition management on a not partitioned table is not possible
CACHE INDEX t2 INDEX (`inx_b`) IN hot_cache;
Table Op Msg_type Msg_text
test.t2 assign_to_keycache Error Key 'inx_b' doesn't exist in table 't2'
test.t2 assign_to_keycache status Operation failed
CACHE INDEX t1 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache error Subpartition sp0 returned error
test.t1 assign_to_keycache Error Key 'inx_b' doesn't exist in table 't1'
test.t1 assign_to_keycache status Operation failed
CACHE INDEX t1 INDEX (`inx_b`) IN hot_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache error Subpartition sp0 returned error
test.t1 assign_to_keycache Error Key 'inx_b' doesn't exist in table 't1'
test.t1 assign_to_keycache status Operation failed
DROP TABLE t1,t2;
SET GLOBAL hot_cache.key_buffer_size = 0;
SET GLOBAL warm_cache.key_buffer_size = 0;
SET @@global.cold_cache.key_buffer_size = 0;
SELECT @@global.default.key_buffer_size a, @@global.default.key_cache_block_size b, @@global.default.key_cache_age_threshold c, @@global.default.key_cache_division_limit d;
a b c d
1048576 1024 300 100
SELECT @@global.hot_cache.key_buffer_size a, @@global.hot_cache.key_cache_block_size b, @@global.hot_cache.key_cache_age_threshold c, @@global.hot_cache.key_cache_division_limit d;
a b c d
0 1024 300 100
SELECT @@global.warm_cache.key_buffer_size a, @@global.warm_cache.key_cache_block_size b, @@global.warm_cache.key_cache_age_threshold c, @@global.warm_cache.key_cache_division_limit d;
a b c d
0 1024 300 100
SELECT @@global.cold_cache.key_buffer_size a, @@global.cold_cache.key_cache_block_size b, @@global.cold_cache.key_cache_age_threshold c, @@global.cold_cache.key_cache_division_limit d;
a b c d
0 1024 300 100
SET @@global.default.key_buffer_size = @org_key_cache_buffer_size;

View file

@ -1,6 +1,19 @@
drop table if exists t1, t2;
create table t1 (a int)
partition by range (a)
subpartition by hash(to_seconds(a))
(partition p0 values less than (1));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50500 PARTITION BY RANGE (a)
SUBPARTITION BY HASH (to_seconds(a))
(PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM) */
drop table t1;
create table t1 (a int)
partition by range (a)
( partition p0 values less than (NULL),
partition p1 values less than (MAXVALUE));
ERROR HY000: Not allowed to use NULL value in VALUES LESS THAN
@ -30,6 +43,14 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
explain partitions select * from t1 where a < '2007-03-07 23:59:59';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 Using where
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50500 PARTITION BY RANGE (TO_SECONDS(a))
(PARTITION p0 VALUES LESS THAN (63340531200) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (63342604800) ENGINE = MyISAM) */
drop table t1;
create table t1 (a date)
partition by range(to_seconds(a))
@ -53,6 +74,14 @@ select * from t1 where a <= '2005-01-01';
a
2003-12-30
2004-12-31
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50500 PARTITION BY RANGE (to_seconds(a))
(PARTITION p0 VALUES LESS THAN (63240134400) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (63271756800) ENGINE = MyISAM) */
drop table t1;
create table t1 (a datetime)
partition by range(to_seconds(a))
@ -75,6 +104,14 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
select * from t1 where a <= '2005-01-01';
a
2004-01-01 11:59:29
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50500 PARTITION BY RANGE (to_seconds(a))
(PARTITION p0 VALUES LESS THAN (63240177600) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (63271800000) ENGINE = MyISAM) */
drop table t1;
create table t1 (a int, b char(20))
partition by range columns(a,b)

View file

@ -7,7 +7,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST COLUMNS(a)
/*!50500 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN (_cp1250 0x81) ENGINE = MyISAM) */
drop table t1;
create table t1 (a varchar(2) character set cp1250)
@ -18,7 +18,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST COLUMNS(a)
/*!50500 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN ('€') ENGINE = MyISAM) */
drop table t1;
create table t1 (a varchar(1500), b varchar(1570))
@ -45,7 +45,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST COLUMNS(a)
/*!50500 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN ('†') ENGINE = MyISAM,
PARTITION p1 VALUES IN ('') ENGINE = MyISAM) */
insert into t1 values ('');

View file

@ -1917,6 +1917,31 @@ execute stmt using @arg;
?
-12345.5432100000
deallocate prepare stmt;
#
# Bug#48508: Crash on prepared statement re-execution.
#
create table t1(b int);
insert into t1 values (0);
create view v1 AS select 1 as a from t1 where b;
prepare stmt from "select * from v1 where a";
execute stmt;
a
execute stmt;
a
deallocate prepare stmt;
drop table t1;
drop view v1;
create table t1(a bigint);
create table t2(b tinyint);
insert into t2 values (null);
prepare stmt from "select 1 from t1 join t2 on a xor b where b > 1 and a =1";
execute stmt;
1
execute stmt;
1
deallocate prepare stmt;
drop table t1,t2;
#
End of 5.0 tests.
create procedure proc_1() reset query cache;
call proc_1();
@ -2926,6 +2951,25 @@ execute stmt;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
drop table t1;
deallocate prepare stmt;
#
# Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0
#
prepare encode from "select encode(?, ?) into @ciphertext";
prepare decode from "select decode(?, ?) into @plaintext";
set @str="abc", @key="cba";
execute encode using @str, @key;
execute decode using @ciphertext, @key;
select @plaintext;
@plaintext
abc
set @str="bcd", @key="dcb";
execute encode using @str, @key;
execute decode using @ciphertext, @key;
select @plaintext;
@plaintext
bcd
deallocate prepare encode;
deallocate prepare decode;
End of 5.1 tests.

View file

@ -176,21 +176,6 @@ a
1
2
3
select * from t1 union select sql_cache * from t1;
a
1
2
3
select * from t1 where a IN (select sql_cache a from t1);
a
1
2
3
select * from t1 where a IN (select a from t1 union select sql_cache a from t1);
a
1
2
3
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
@ -207,41 +192,6 @@ a
1
2
3
select * from t1 union select sql_no_cache * from t1;
a
1
2
3
select * from t1 where a IN (select sql_no_cache a from t1);
a
1
2
3
select * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
a
1
2
3
select sql_cache sql_no_cache * from t1;
a
1
2
3
select sql_cache * from t1 union select sql_no_cache * from t1;
a
1
2
3
select sql_cache * from t1 where a IN (select sql_no_cache a from t1);
a
1
2
3
select sql_cache * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
@ -1490,12 +1440,6 @@ insert into t1 values ('c');
a
drop table t1;
set GLOBAL query_cache_size= default;
set GLOBAL query_cache_size=1000000;
create table t1 (a char);
insert into t1 values ('c');
a
drop table t1;
set GLOBAL query_cache_size= default;
SET GLOBAL query_cache_size=64*1024*1024;
CREATE TABLE t1 (id INT);
CREATE PROCEDURE proc29856(IN theUPC TEXT)
@ -1723,4 +1667,55 @@ SELECT 1 FROM t1 GROUP BY
1
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
CREATE TABLE t1( a INT );
SET @v = ( SELECT SQL_CACHE 1 );
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 )' at line 1
SET @v = ( SELECT SQL_NO_CACHE 1 );
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 )' at line 1
SELECT a FROM t1 WHERE a IN ( SELECT SQL_CACHE a FROM t1 );
ERROR 42S22: Unknown column 'SQL_CACHE' in 'field list'
SELECT a FROM t1 WHERE a IN ( SELECT SQL_NO_CACHE a FROM t1 );
ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list'
SELECT ( SELECT SQL_CACHE a FROM t1 );
ERROR 42S22: Unknown column 'SQL_CACHE' in 'field list'
SELECT ( SELECT SQL_NO_CACHE a FROM t1 );
ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list'
SELECT SQL_CACHE * FROM t1;
a
SELECT SQL_NO_CACHE * FROM t1;
a
SELECT * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
ERROR 42000: Incorrect usage/placement of 'SQL_CACHE'
SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT * FROM t1 WHERE a IN (SELECT SQL_CACHE a FROM t1);
ERROR 42S22: Unknown column 'SQL_CACHE' in 'field list'
SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 UNION SELECT SQL_CACHE a FROM t1);
ERROR 42S22: Unknown column 'SQL_CACHE' in 'field list'
SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT * FROM t1 WHERE a IN (SELECT SQL_NO_CACHE a FROM t1);
ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list'
SELECT * FROM t1 WHERE a IN
(SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list'
SELECT SQL_CACHE SQL_NO_CACHE * FROM t1;
ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE
SELECT SQL_NO_CACHE SQL_CACHE * FROM t1;
ERROR HY000: Incorrect usage of SQL_NO_CACHE and SQL_CACHE
SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
ERROR 42000: Incorrect usage/placement of 'SQL_CACHE'
SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
ERROR 42000: Incorrect usage/placement of 'SQL_CACHE'
SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT SQL_CACHE * FROM t1 WHERE a IN
(SELECT SQL_NO_CACHE a FROM t1);
ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list'
SELECT SQL_CACHE * FROM t1 WHERE a IN
(SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list'
DROP TABLE t1;
End of 5.1 tests

View file

@ -4446,6 +4446,91 @@ SELECT 1 FROM t2 JOIN t1 ON 1=1
WHERE a != '1' AND NOT a >= b OR NOT ROW(b,a )<> ROW(a,a);
1
DROP TABLE t1,t2;
#
# Bug #49199: Optimizer handles incorrectly:
# field='const1' AND field='const2' in some cases
CREATE TABLE t1(a DATETIME NOT NULL);
INSERT INTO t1 VALUES('2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
a
2001-01-01 00:00:00
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select '2001-01-01 00:00:00' AS `a` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
a
2001-01-01
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select '2001-01-01' AS `a` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a TIMESTAMP NOT NULL);
INSERT INTO t1 VALUES('2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
a
2001-01-01 00:00:00
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select '2001-01-01 00:00:00' AS `a` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
a b
2001-01-01 00:00:00 2001-01-01
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a DATETIME NOT NULL, b VARCHAR(20) NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
a b
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 0
SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01';
a b
2001-01-01 00:00:00 2001-01-01
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
SELECT x.a, y.a, z.a FROM t1 x
JOIN t1 y ON x.a=y.a
JOIN t1 z ON y.a=z.a
WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00';
a a a
2001-01-01 00:00:00 2001-01-01 00:00:00 2001-01-01 00:00:00
EXPLAIN EXTENDED SELECT x.a, y.a, z.a FROM t1 x
JOIN t1 y ON x.a=y.a
JOIN t1 z ON y.a=z.a
WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE x system NULL NULL NULL NULL 1 100.00
1 SIMPLE y system NULL NULL NULL NULL 1 100.00
1 SIMPLE z system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a` from dual where 1
DROP TABLE t1;
End of 5.0 tests
create table t1(a INT, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
@ -4680,4 +4765,29 @@ HAVING v <= 't'
ORDER BY pk;
v
DROP TABLE t1;
#
# Bug#49489 Uninitialized cache led to a wrong result.
#
CREATE TABLE t1(c1 DOUBLE(5,4));
INSERT INTO t1 VALUES (9.1234);
SELECT * FROM t1 WHERE c1 < 9.12345;
c1
9.1234
DROP TABLE t1;
# End of test for bug#49489.
#
# Bug #49517: Inconsistent behavior while using
# NULLable BIGINT and INT columns in comparison
#
CREATE TABLE t1(a BIGINT UNSIGNED NOT NULL, b BIGINT NULL, c INT NULL);
INSERT INTO t1 VALUES(105, NULL, NULL);
SELECT * FROM t1 WHERE b < 102;
a b c
SELECT * FROM t1 WHERE c < 102;
a b c
SELECT * FROM t1 WHERE 102 < b;
a b c
SELECT * FROM t1 WHERE 102 < c;
a b c
DROP TABLE t1;
End of 5.1 tests

View file

@ -737,20 +737,11 @@ View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary
DROP VIEW v1;
CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW();
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary
DROP VIEW v1;
ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE
CREATE VIEW v1 AS SELECT SQL_NO_CACHE SQL_CACHE NOW();
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary
DROP VIEW v1;
ERROR HY000: Incorrect usage of SQL_NO_CACHE and SQL_CACHE
CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE SQL_CACHE NOW();
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary
DROP VIEW v1;
ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE
CREATE PROCEDURE p1()
BEGIN
SET @s= 'CREATE VIEW v1 AS SELECT SQL_CACHE 1';
@ -1446,4 +1437,10 @@ GRANT PROCESS ON *.* TO test_u@localhost;
SHOW ENGINE MYISAM MUTEX;
SHOW ENGINE MYISAM STATUS;
DROP USER test_u@localhost;
#
# Bug #48985: show create table crashes if previous access to the table
# was killed
#
SHOW CREATE TABLE non_existent;
ERROR 70100: Query execution was interrupted
End of 5.1 tests

View file

@ -120,3 +120,29 @@ DECLARE f2 VARCHAR(64) COLLATE ucs2_unicode_ci;
RETURN 'str';
END|
ERROR 42000: This version of MySQL doesn't yet support 'COLLATE with no CHARACTER SET in SP parameters, RETURNS, DECLARE'
SET NAMES utf8;
DROP FUNCTION IF EXISTS bug48766;
CREATE FUNCTION bug48766 ()
RETURNS ENUM( 'w' ) CHARACTER SET ucs2
RETURN 0;
SHOW CREATE FUNCTION bug48766;
Function sql_mode Create Function character_set_client collation_connection Database Collation
bug48766 CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('w') CHARSET ucs2
RETURN 0 utf8 utf8_general_ci latin1_swedish_ci
SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME='bug48766';
DTD_IDENTIFIER
enum('w') CHARSET ucs2
DROP FUNCTION bug48766;
CREATE FUNCTION bug48766 ()
RETURNS ENUM('а','б','в','г') CHARACTER SET ucs2
RETURN 0;
SHOW CREATE FUNCTION bug48766;
Function sql_mode Create Function character_set_client collation_connection Database Collation
bug48766 CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('а','б','в','г') CHARSET ucs2
RETURN 0 utf8 utf8_general_ci latin1_swedish_ci
SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME='bug48766';
DTD_IDENTIFIER
enum('а','б','в','г') CHARSET ucs2
DROP FUNCTION bug48766;

View file

@ -4419,6 +4419,31 @@ WHERE a = 230;
MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
NULL 0
DROP TABLE t1, st1, st2;
#
# Bug #48709: Assertion failed in sql_select.cc:11782:
# int join_read_key(JOIN_TAB*)
#
CREATE TABLE t1 (pk int PRIMARY KEY, int_key int);
INSERT INTO t1 VALUES (10,1), (14,1);
CREATE TABLE t2 (pk int PRIMARY KEY, int_key int);
INSERT INTO t2 VALUES (3,3), (5,NULL), (7,3);
# should have eq_ref for t1
EXPLAIN
SELECT * FROM t2 outr
WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2)
ORDER BY outr.pk;
id select_type table type possible_keys key key_len ref rows Extra
x x outr ALL x x x x x x
x x t1 eq_ref x x x x x x
x x t2 index x x x x x x
# should not crash on debug binaries
SELECT * FROM t2 outr
WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2)
ORDER BY outr.pk;
pk int_key
3 3
7 3
DROP TABLE t1,t2;
End of 5.0 tests.
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (2,22),(1,11),(2,22);

View file

@ -46,3 +46,267 @@ a
2001
drop table t1;
End of 5.0 tests
#
# Bug #49480: WHERE using YEAR columns returns unexpected results
#
CREATE TABLE t2(yy YEAR(2), c2 CHAR(4));
CREATE TABLE t4(yyyy YEAR(4), c4 CHAR(4));
INSERT INTO t2 (c2) VALUES (NULL),(1970),(1999),(2000),(2001),(2069);
INSERT INTO t4 (c4) SELECT c2 FROM t2;
UPDATE t2 SET yy = c2;
UPDATE t4 SET yyyy = c4;
SELECT * FROM t2;
yy c2
NULL NULL
70 1970
99 1999
00 2000
01 2001
69 2069
SELECT * FROM t4;
yyyy c4
NULL NULL
1970 1970
1999 1999
2000 2000
2001 2001
2069 2069
# Comparison of YEAR(2) with YEAR(4)
SELECT * FROM t2, t4 WHERE yy = yyyy;
yy c2 yyyy c4
70 1970 1970 1970
99 1999 1999 1999
00 2000 2000 2000
01 2001 2001 2001
69 2069 2069 2069
SELECT * FROM t2, t4 WHERE yy <=> yyyy;
yy c2 yyyy c4
NULL NULL NULL NULL
70 1970 1970 1970
99 1999 1999 1999
00 2000 2000 2000
01 2001 2001 2001
69 2069 2069 2069
SELECT * FROM t2, t4 WHERE yy < yyyy;
yy c2 yyyy c4
70 1970 1999 1999
70 1970 2000 2000
99 1999 2000 2000
70 1970 2001 2001
99 1999 2001 2001
00 2000 2001 2001
70 1970 2069 2069
99 1999 2069 2069
00 2000 2069 2069
01 2001 2069 2069
SELECT * FROM t2, t4 WHERE yy > yyyy;
yy c2 yyyy c4
99 1999 1970 1970
00 2000 1970 1970
01 2001 1970 1970
69 2069 1970 1970
00 2000 1999 1999
01 2001 1999 1999
69 2069 1999 1999
01 2001 2000 2000
69 2069 2000 2000
69 2069 2001 2001
# Comparison of YEAR(2) with YEAR(2)
SELECT * FROM t2 a, t2 b WHERE a.yy = b.yy;
yy c2 yy c2
70 1970 70 1970
99 1999 99 1999
00 2000 00 2000
01 2001 01 2001
69 2069 69 2069
SELECT * FROM t2 a, t2 b WHERE a.yy <=> b.yy;
yy c2 yy c2
NULL NULL NULL NULL
70 1970 70 1970
99 1999 99 1999
00 2000 00 2000
01 2001 01 2001
69 2069 69 2069
SELECT * FROM t2 a, t2 b WHERE a.yy < b.yy;
yy c2 yy c2
70 1970 99 1999
70 1970 00 2000
99 1999 00 2000
70 1970 01 2001
99 1999 01 2001
00 2000 01 2001
70 1970 69 2069
99 1999 69 2069
00 2000 69 2069
01 2001 69 2069
# Comparison of YEAR(4) with YEAR(4)
SELECT * FROM t4 a, t4 b WHERE a.yyyy = b.yyyy;
yyyy c4 yyyy c4
1970 1970 1970 1970
1999 1999 1999 1999
2000 2000 2000 2000
2001 2001 2001 2001
2069 2069 2069 2069
SELECT * FROM t4 a, t4 b WHERE a.yyyy <=> b.yyyy;
yyyy c4 yyyy c4
NULL NULL NULL NULL
1970 1970 1970 1970
1999 1999 1999 1999
2000 2000 2000 2000
2001 2001 2001 2001
2069 2069 2069 2069
SELECT * FROM t4 a, t4 b WHERE a.yyyy < b.yyyy;
yyyy c4 yyyy c4
1970 1970 1999 1999
1970 1970 2000 2000
1999 1999 2000 2000
1970 1970 2001 2001
1999 1999 2001 2001
2000 2000 2001 2001
1970 1970 2069 2069
1999 1999 2069 2069
2000 2000 2069 2069
2001 2001 2069 2069
# Comparison with constants:
SELECT * FROM t2 WHERE yy = NULL;
yy c2
SELECT * FROM t4 WHERE yyyy = NULL;
yyyy c4
SELECT * FROM t2 WHERE yy <=> NULL;
yy c2
NULL NULL
SELECT * FROM t4 WHERE yyyy <=> NULL;
yyyy c4
NULL NULL
SELECT * FROM t2 WHERE yy < NULL;
yy c2
SELECT * FROM t2 WHERE yy > NULL;
yy c2
SELECT * FROM t2 WHERE yy = NOW();
yy c2
SELECT * FROM t4 WHERE yyyy = NOW();
yyyy c4
SELECT * FROM t2 WHERE yy = 99;
yy c2
99 1999
SELECT * FROM t2 WHERE 99 = yy;
yy c2
99 1999
SELECT * FROM t4 WHERE yyyy = 99;
yyyy c4
1999 1999
SELECT * FROM t2 WHERE yy = 'test';
yy c2
00 2000
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'test'
SELECT * FROM t4 WHERE yyyy = 'test';
yyyy c4
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'test'
SELECT * FROM t2 WHERE yy = '1999';
yy c2
99 1999
SELECT * FROM t4 WHERE yyyy = '1999';
yyyy c4
1999 1999
SELECT * FROM t2 WHERE yy = 1999;
yy c2
99 1999
SELECT * FROM t4 WHERE yyyy = 1999;
yyyy c4
1999 1999
SELECT * FROM t2 WHERE yy = 1999.1;
yy c2
99 1999
SELECT * FROM t4 WHERE yyyy = 1999.1;
yyyy c4
1999 1999
SELECT * FROM t2 WHERE yy = 1998.9;
yy c2
99 1999
SELECT * FROM t4 WHERE yyyy = 1998.9;
yyyy c4
1999 1999
# Coverage tests for YEAR with zero/2000 constants:
SELECT * FROM t2 WHERE yy = 0;
yy c2
00 2000
SELECT * FROM t2 WHERE yy = '0';
yy c2
00 2000
SELECT * FROM t2 WHERE yy = '0000';
yy c2
00 2000
SELECT * FROM t2 WHERE yy = '2000';
yy c2
00 2000
SELECT * FROM t2 WHERE yy = 2000;
yy c2
00 2000
SELECT * FROM t4 WHERE yyyy = 0;
yyyy c4
SELECT * FROM t4 WHERE yyyy = '0';
yyyy c4
2000 2000
SELECT * FROM t4 WHERE yyyy = '0000';
yyyy c4
SELECT * FROM t4 WHERE yyyy = '2000';
yyyy c4
2000 2000
SELECT * FROM t4 WHERE yyyy = 2000;
yyyy c4
2000 2000
# Comparison with constants those are out of YEAR range
# (coverage test for backward compatibility)
SELECT COUNT(yy) FROM t2;
COUNT(yy)
5
SELECT COUNT(yyyy) FROM t4;
COUNT(yyyy)
5
SELECT COUNT(*) FROM t2 WHERE yy = -1;
COUNT(*)
0
SELECT COUNT(*) FROM t4 WHERE yyyy > -1;
COUNT(*)
5
SELECT COUNT(*) FROM t2 WHERE yy > -1000000000000000000;
COUNT(*)
5
SELECT COUNT(*) FROM t4 WHERE yyyy > -1000000000000000000;
COUNT(*)
5
SELECT COUNT(*) FROM t2 WHERE yy < 2156;
COUNT(*)
5
SELECT COUNT(*) FROM t4 WHERE yyyy < 2156;
COUNT(*)
5
SELECT COUNT(*) FROM t2 WHERE yy < 1000000000000000000;
COUNT(*)
5
SELECT COUNT(*) FROM t4 WHERE yyyy < 1000000000000000000;
COUNT(*)
5
SELECT * FROM t2 WHERE yy < 123;
yy c2
70 1970
99 1999
00 2000
01 2001
69 2069
SELECT * FROM t2 WHERE yy > 123;
yy c2
SELECT * FROM t4 WHERE yyyy < 123;
yyyy c4
SELECT * FROM t4 WHERE yyyy > 123;
yyyy c4
1970 1970
1999 1999
2000 2000
2001 2001
2069 2069
DROP TABLE t2, t4;
#
End of 5.1 tests

View file

@ -1018,6 +1018,12 @@ ERROR HY000: Variable 'hostname' is a read only variable
show variables like 'hostname';
Variable_name Value
hostname #
#
# BUG#37408 - Compressed MyISAM files should not require/use mmap()
#
# Test 'myisam_mmap_size' option is not dynamic
SET @@myisam_mmap_size= 500M;
ERROR HY000: Variable 'myisam_mmap_size' is a read only variable
End of 5.0 tests
set join_buffer_size=1;
Warnings:

View file

@ -18,6 +18,13 @@
</rules>
</collation>
<collation name="utf8_hugeid_ci" id="2047000000">
<rules>
<reset>a</reset>
<s>b</s>
</rules>
</collation>
<collation name="utf8_maxuserid_ci" id="2047">
<rules>
<reset>a</reset>

View file

@ -1,3 +1,8 @@
call mtr.add_suppression('Attempting backtrace');
call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.');
call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file');
call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.');
call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
flush logs;
flush logs;
flush logs;
@ -21,7 +26,6 @@ flush logs;
*** must be a warning master-bin.000001 was not found ***
Warnings:
Warning 1612 Being purged log master-bin.000001 was not found
Warning 1612 Being purged log master-bin.000001 was not found
*** must show one record, of the active binlog, left in the index file after PURGE ***
show binary logs;
Log_name File_size
@ -37,4 +41,111 @@ Level Code Message
Warning 1377 a problem with deleting master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files
Error 1377 Fatal error during log purge
reset master;
# crash_purge_before_update_index
flush logs;
SET SESSION debug="+d,crash_purge_before_update_index";
purge binary logs TO 'master-bin.000002';
ERROR HY000: Lost connection to MySQL server during query
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
master-bin.000001
master-bin.000002
master-bin.000003
# crash_purge_non_critical_after_update_index
flush logs;
SET SESSION debug="+d,crash_purge_non_critical_after_update_index";
purge binary logs TO 'master-bin.000004';
ERROR HY000: Lost connection to MySQL server during query
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
master-bin.000004
master-bin.000005
# crash_purge_critical_after_update_index
flush logs;
SET SESSION debug="+d,crash_purge_critical_after_update_index";
purge binary logs TO 'master-bin.000006';
ERROR HY000: Lost connection to MySQL server during query
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
master-bin.000006
master-bin.000007
# crash_create_non_critical_before_update_index
SET SESSION debug="+d,crash_create_non_critical_before_update_index";
flush logs;
ERROR HY000: Lost connection to MySQL server during query
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
master-bin.000006
master-bin.000007
master-bin.000008
# crash_create_critical_before_update_index
SET SESSION debug="+d,crash_create_critical_before_update_index";
flush logs;
ERROR HY000: Lost connection to MySQL server during query
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
master-bin.000006
master-bin.000007
master-bin.000008
master-bin.000009
# crash_create_after_update_index
SET SESSION debug="+d,crash_create_after_update_index";
flush logs;
ERROR HY000: Lost connection to MySQL server during query
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
master-bin.000006
master-bin.000007
master-bin.000008
master-bin.000009
master-bin.000010
master-bin.000011
#
# This should put the server in unsafe state and stop
# accepting any command. If we inject a fault at this
# point and continue the execution the server crashes.
# Besides the flush command does not report an error.
#
# fault_injection_registering_index
SET SESSION debug="+d,fault_injection_registering_index";
flush logs;
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
master-bin.000006
master-bin.000007
master-bin.000008
master-bin.000009
master-bin.000010
master-bin.000011
master-bin.000012
# fault_injection_updating_index
SET SESSION debug="+d,fault_injection_updating_index";
flush logs;
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
master-bin.000006
master-bin.000007
master-bin.000008
master-bin.000009
master-bin.000010
master-bin.000011
master-bin.000012
master-bin.000013
SET SESSION debug="";
End of tests

View file

@ -3,6 +3,18 @@
#
source include/have_log_bin.inc;
source include/not_embedded.inc;
# Don't test this under valgrind, memory leaks will occur
--source include/not_valgrind.inc
source include/have_debug.inc;
call mtr.add_suppression('Attempting backtrace');
call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.');
call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file');
call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.');
call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
let $old=`select @@debug`;
let $MYSQLD_DATADIR= `select @@datadir`;
let $INDEX=$MYSQLD_DATADIR/master-bin.index;
#
# testing purge binary logs TO
@ -13,7 +25,6 @@ flush logs;
flush logs;
source include/show_binary_logs.inc;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/master-bin.000001;
# there must be a warning with file names
@ -66,4 +77,159 @@ rmdir $MYSQLD_DATADIR/master-bin.000001;
--disable_warnings
reset master;
--enable_warnings
--echo # crash_purge_before_update_index
flush logs;
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug="+d,crash_purge_before_update_index";
--error 2013
purge binary logs TO 'master-bin.000002';
--enable_reconnect
--source include/wait_until_connected_again.inc
file_exists $MYSQLD_DATADIR/master-bin.000001;
file_exists $MYSQLD_DATADIR/master-bin.000002;
file_exists $MYSQLD_DATADIR/master-bin.000003;
--chmod 0644 $INDEX
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval SET @index=LOAD_FILE('$index')
-- replace_regex /\.[\\\/]master/master/
SELECT @index;
--echo # crash_purge_non_critical_after_update_index
flush logs;
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug="+d,crash_purge_non_critical_after_update_index";
--error 2013
purge binary logs TO 'master-bin.000004';
--enable_reconnect
--source include/wait_until_connected_again.inc
--error 1
file_exists $MYSQLD_DATADIR/master-bin.000001;
--error 1
file_exists $MYSQLD_DATADIR/master-bin.000002;
--error 1
file_exists $MYSQLD_DATADIR/master-bin.000003;
--chmod 0644 $INDEX
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval SET @index=LOAD_FILE('$index')
-- replace_regex /\.[\\\/]master/master/
SELECT @index;
--echo # crash_purge_critical_after_update_index
flush logs;
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug="+d,crash_purge_critical_after_update_index";
--error 2013
purge binary logs TO 'master-bin.000006';
--enable_reconnect
--source include/wait_until_connected_again.inc
--error 1
file_exists $MYSQLD_DATADIR/master-bin.000004;
--error 1
file_exists $MYSQLD_DATADIR/master-bin.000005;
file_exists $MYSQLD_DATADIR/master-bin.000006;
file_exists $MYSQLD_DATADIR/master-bin.000007;
--error 1
file_exists $MYSQLD_DATADIR/master-bin.000008;
--chmod 0644 $INDEX
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval SET @index=LOAD_FILE('$index')
-- replace_regex /\.[\\\/]master/master/
SELECT @index;
--echo # crash_create_non_critical_before_update_index
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug="+d,crash_create_non_critical_before_update_index";
--error 2013
flush logs;
--enable_reconnect
--source include/wait_until_connected_again.inc
file_exists $MYSQLD_DATADIR/master-bin.000008;
--error 1
file_exists $MYSQLD_DATADIR/master-bin.000009;
--chmod 0644 $INDEX
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval SET @index=LOAD_FILE('$index')
-- replace_regex /\.[\\\/]master/master/
SELECT @index;
--echo # crash_create_critical_before_update_index
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug="+d,crash_create_critical_before_update_index";
--error 2013
flush logs;
--enable_reconnect
--source include/wait_until_connected_again.inc
file_exists $MYSQLD_DATADIR/master-bin.000009;
--error 1
file_exists $MYSQLD_DATADIR/master-bin.000010;
--error 1
file_exists $MYSQLD_DATADIR/master-bin.000011;
--chmod 0644 $INDEX
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval SET @index=LOAD_FILE('$index')
-- replace_regex /\.[\\\/]master/master/
SELECT @index;
--echo # crash_create_after_update_index
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug="+d,crash_create_after_update_index";
--error 2013
flush logs;
--enable_reconnect
--source include/wait_until_connected_again.inc
file_exists $MYSQLD_DATADIR/master-bin.000010;
file_exists $MYSQLD_DATADIR/master-bin.000011;
--chmod 0644 $INDEX
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval SET @index=LOAD_FILE('$index')
-- replace_regex /\.[\\\/]master/master/
SELECT @index;
--echo #
--echo # This should put the server in unsafe state and stop
--echo # accepting any command. If we inject a fault at this
--echo # point and continue the execution the server crashes.
--echo # Besides the flush command does not report an error.
--echo #
--echo # fault_injection_registering_index
SET SESSION debug="+d,fault_injection_registering_index";
flush logs;
--source include/restart_mysqld.inc
--chmod 0644 $INDEX
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval SET @index=LOAD_FILE('$index')
-- replace_regex /\.[\\\/]master/master/
SELECT @index;
--echo # fault_injection_updating_index
SET SESSION debug="+d,fault_injection_updating_index";
flush logs;
--source include/restart_mysqld.inc
--chmod 0644 $INDEX
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval SET @index=LOAD_FILE('$index')
-- replace_regex /\.[\\\/]master/master/
SELECT @index;
eval SET SESSION debug="$old";
--echo End of tests

View file

@ -0,0 +1,9 @@
create table ABC (i int) engine=ibmdb2i;
insert into ABC values(1);
create table abc (i int) engine=ibmdb2i;
insert into abc values (2);
select * from ABC;
i
1
drop table ABC;
drop table abc;

View file

@ -0,0 +1,10 @@
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source include/have_case_sensitive_file_system.inc;
create table ABC (i int) engine=ibmdb2i;
insert into ABC values(1);
create table abc (i int) engine=ibmdb2i;
insert into abc values (2);
select * from ABC;
drop table ABC;
drop table abc;

View file

@ -152,10 +152,16 @@ let $valsqlfunc = timestampdiff(YEAR,'2002-05-01','2001-01-01');
let $coltype = datetime;
--source suite/parts/inc/partition_blocked_sql_funcs.inc
let $sqlfunc = unix_timestamp(col1);
let $valsqlfunc = unix_timestamp ('2002-05-01');
let $coltype = date;
--source suite/parts/inc/partition_blocked_sql_funcs.inc
################################################################################
# After the fix for bug #42849 the server behavior does not fit into this test's
# architecture: for UNIX_TIMESTAMP() some of the queries in
# suite/parts/inc/partition_blocked_sql_funcs.inc will fail with a different
# error (ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR) and some will succeed where
################################################################################
#let $sqlfunc = unix_timestamp(col1);
#let $valsqlfunc = unix_timestamp ('2002-05-01');
#let $coltype = date;
#--source suite/parts/inc/partition_blocked_sql_funcs.inc
let $sqlfunc = week(col1);
let $valsqlfunc = week('2002-05-01');

View file

@ -33,42 +33,48 @@ select count(*) from t2;
select * from t2;
drop table t2;
eval create table t3 (a timestamp not null, primary key(a)) engine=$engine
partition by range (month(a)) subpartition by key (a)
subpartitions 3 (
partition quarter1 values less than (4),
partition quarter2 values less than (7),
partition quarter3 values less than (10),
partition quarter4 values less than (13)
);
show create table t3;
let $count=12;
--echo $count inserts;
while ($count)
{
eval insert into t3 values (date_add('1970-01-01 00:00:00',interval $count-1 month));
dec $count;
}
select count(*) from t3;
select * from t3;
drop table t3;
################################################################################
# The following 2 tests are no longer valid after bug #42849 has been fixed:
# it is not possible to use a timezone-dependent (such as month(timestamp_col)
# or just a timestamp_col in a numeric context) anymore.
################################################################################
eval create table t4 (a timestamp not null, primary key(a)) engine=$engine
partition by list (month(a)) subpartition by key (a)
subpartitions 3 (
partition quarter1 values in (0,1,2,3),
partition quarter2 values in (4,5,6),
partition quarter3 values in (7,8,9),
partition quarter4 values in (10,11,12)
);
show create table t4;
let $count=12;
--echo $count inserts;
while ($count)
{
eval insert into t4 values (date_add('1970-01-01 00:00:00',interval $count-1 month));
dec $count;
}
select count(*) from t4;
select * from t4;
drop table t4;
# eval create table t3 (a timestamp not null, primary key(a)) engine=$engine
# partition by range (month(a)) subpartition by key (a)
# subpartitions 3 (
# partition quarter1 values less than (4),
# partition quarter2 values less than (7),
# partition quarter3 values less than (10),
# partition quarter4 values less than (13)
# );
# show create table t3;
# let $count=12;
# --echo $count inserts;
# while ($count)
# {
# eval insert into t3 values (date_add('1970-01-01 00:00:00',interval $count-1 month));
# dec $count;
# }
# select count(*) from t3;
# select * from t3;
# drop table t3;
# eval create table t4 (a timestamp not null, primary key(a)) engine=$engine
# partition by list (month(a)) subpartition by key (a)
# subpartitions 3 (
# partition quarter1 values in (0,1,2,3),
# partition quarter2 values in (4,5,6),
# partition quarter3 values in (7,8,9),
# partition quarter4 values in (10,11,12)
# );
# show create table t4;
# let $count=12;
# --echo $count inserts;
# while ($count)
# {
# eval insert into t4 values (date_add('1970-01-01 00:00:00',interval $count-1 month));
# dec $count;
# }
# select count(*) from t4;
# select * from t4;
# drop table t4;

View file

@ -2942,104 +2942,6 @@ drop table if exists t44 ;
drop table if exists t55 ;
drop table if exists t66 ;
-------------------------------------------------------------------------
--- unix_timestamp(col1) in partition with coltype date
-------------------------------------------------------------------------
must all fail!
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
drop table if exists t4 ;
drop table if exists t5 ;
drop table if exists t6 ;
create table t1 (col1 date) engine='INNODB'
partition by range(unix_timestamp(col1))
(partition p0 values less than (15),
partition p1 values less than (31));
Got one of the listed errors
create table t2 (col1 date) engine='INNODB'
partition by list(unix_timestamp(col1))
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
Got one of the listed errors
create table t3 (col1 date) engine='INNODB'
partition by hash(unix_timestamp(col1));
Got one of the listed errors
create table t4 (colint int, col1 date) engine='INNODB'
partition by range(colint)
subpartition by hash(unix_timestamp(col1)) subpartitions 2
(partition p0 values less than (15),
partition p1 values less than (31));
Got one of the listed errors
create table t5 (colint int, col1 date) engine='INNODB'
partition by list(colint)
subpartition by hash(unix_timestamp(col1)) subpartitions 2
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
Got one of the listed errors
create table t6 (colint int, col1 date) engine='INNODB'
partition by range(colint)
(partition p0 values less than (unix_timestamp ('2002-05-01')),
partition p1 values less than maxvalue);
Got one of the listed errors
drop table if exists t11 ;
drop table if exists t22 ;
drop table if exists t33 ;
drop table if exists t44 ;
drop table if exists t55 ;
drop table if exists t66 ;
create table t11 (col1 date) engine='INNODB' ;
create table t22 (col1 date) engine='INNODB' ;
create table t33 (col1 date) engine='INNODB' ;
create table t44 (colint int, col1 date) engine='INNODB' ;
create table t55 (colint int, col1 date) engine='INNODB' ;
create table t66 (colint int, col1 date) engine='INNODB' ;
alter table t11
partition by range(unix_timestamp(col1))
(partition p0 values less than (15),
partition p1 values less than (31));
Got one of the listed errors
alter table t22
partition by list(unix_timestamp(col1))
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
Got one of the listed errors
alter table t33
partition by hash(unix_timestamp(col1));
Got one of the listed errors
alter table t44
partition by range(colint)
subpartition by hash(unix_timestamp(col1)) subpartitions 2
(partition p0 values less than (15),
partition p1 values less than (31));
Got one of the listed errors
alter table t55
partition by list(colint)
subpartition by hash(unix_timestamp(col1)) subpartitions 2
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
Got one of the listed errors
alter table t66
partition by range(colint)
(partition p0 values less than (unix_timestamp ('2002-05-01')),
partition p1 values less than maxvalue);
Got one of the listed errors
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
drop table if exists t4 ;
drop table if exists t5 ;
drop table if exists t6 ;
drop table if exists t11 ;
drop table if exists t22 ;
drop table if exists t33 ;
drop table if exists t44 ;
drop table if exists t55 ;
drop table if exists t66 ;
-------------------------------------------------------------------------
--- week(col1) in partition with coltype datetime
-------------------------------------------------------------------------
must all fail!

View file

@ -2942,104 +2942,6 @@ drop table if exists t44 ;
drop table if exists t55 ;
drop table if exists t66 ;
-------------------------------------------------------------------------
--- unix_timestamp(col1) in partition with coltype date
-------------------------------------------------------------------------
must all fail!
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
drop table if exists t4 ;
drop table if exists t5 ;
drop table if exists t6 ;
create table t1 (col1 date) engine='MYISAM'
partition by range(unix_timestamp(col1))
(partition p0 values less than (15),
partition p1 values less than (31));
Got one of the listed errors
create table t2 (col1 date) engine='MYISAM'
partition by list(unix_timestamp(col1))
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
Got one of the listed errors
create table t3 (col1 date) engine='MYISAM'
partition by hash(unix_timestamp(col1));
Got one of the listed errors
create table t4 (colint int, col1 date) engine='MYISAM'
partition by range(colint)
subpartition by hash(unix_timestamp(col1)) subpartitions 2
(partition p0 values less than (15),
partition p1 values less than (31));
Got one of the listed errors
create table t5 (colint int, col1 date) engine='MYISAM'
partition by list(colint)
subpartition by hash(unix_timestamp(col1)) subpartitions 2
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
Got one of the listed errors
create table t6 (colint int, col1 date) engine='MYISAM'
partition by range(colint)
(partition p0 values less than (unix_timestamp ('2002-05-01')),
partition p1 values less than maxvalue);
Got one of the listed errors
drop table if exists t11 ;
drop table if exists t22 ;
drop table if exists t33 ;
drop table if exists t44 ;
drop table if exists t55 ;
drop table if exists t66 ;
create table t11 (col1 date) engine='MYISAM' ;
create table t22 (col1 date) engine='MYISAM' ;
create table t33 (col1 date) engine='MYISAM' ;
create table t44 (colint int, col1 date) engine='MYISAM' ;
create table t55 (colint int, col1 date) engine='MYISAM' ;
create table t66 (colint int, col1 date) engine='MYISAM' ;
alter table t11
partition by range(unix_timestamp(col1))
(partition p0 values less than (15),
partition p1 values less than (31));
Got one of the listed errors
alter table t22
partition by list(unix_timestamp(col1))
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
Got one of the listed errors
alter table t33
partition by hash(unix_timestamp(col1));
Got one of the listed errors
alter table t44
partition by range(colint)
subpartition by hash(unix_timestamp(col1)) subpartitions 2
(partition p0 values less than (15),
partition p1 values less than (31));
Got one of the listed errors
alter table t55
partition by list(colint)
subpartition by hash(unix_timestamp(col1)) subpartitions 2
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
Got one of the listed errors
alter table t66
partition by range(colint)
(partition p0 values less than (unix_timestamp ('2002-05-01')),
partition p1 values less than maxvalue);
Got one of the listed errors
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
drop table if exists t4 ;
drop table if exists t5 ;
drop table if exists t6 ;
drop table if exists t11 ;
drop table if exists t22 ;
drop table if exists t33 ;
drop table if exists t44 ;
drop table if exists t55 ;
drop table if exists t66 ;
-------------------------------------------------------------------------
--- week(col1) in partition with coltype datetime
-------------------------------------------------------------------------
must all fail!

View file

@ -184,114 +184,6 @@ a
1971-01-01 00:00:58
1971-01-01 00:00:59
drop table t2;
create table t3 (a timestamp not null, primary key(a)) engine='InnoDB'
partition by range (month(a)) subpartition by key (a)
subpartitions 3 (
partition quarter1 values less than (4),
partition quarter2 values less than (7),
partition quarter3 values less than (10),
partition quarter4 values less than (13)
);
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (month(a))
SUBPARTITION BY KEY (a)
SUBPARTITIONS 3
(PARTITION quarter1 VALUES LESS THAN (4) ENGINE = InnoDB,
PARTITION quarter2 VALUES LESS THAN (7) ENGINE = InnoDB,
PARTITION quarter3 VALUES LESS THAN (10) ENGINE = InnoDB,
PARTITION quarter4 VALUES LESS THAN (13) ENGINE = InnoDB) */
12 inserts;
insert into t3 values (date_add('1970-01-01 00:00:00',interval 12-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 11-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 10-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 9-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 8-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 7-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 6-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 5-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 4-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 3-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 2-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 1-1 month));
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select count(*) from t3;
count(*)
12
select * from t3;
a
0000-00-00 00:00:00
1970-02-01 00:00:00
1970-03-01 00:00:00
1970-04-01 00:00:00
1970-05-01 00:00:00
1970-06-01 00:00:00
1970-07-01 00:00:00
1970-08-01 00:00:00
1970-09-01 00:00:00
1970-10-01 00:00:00
1970-11-01 00:00:00
1970-12-01 00:00:00
drop table t3;
create table t4 (a timestamp not null, primary key(a)) engine='InnoDB'
partition by list (month(a)) subpartition by key (a)
subpartitions 3 (
partition quarter1 values in (0,1,2,3),
partition quarter2 values in (4,5,6),
partition quarter3 values in (7,8,9),
partition quarter4 values in (10,11,12)
);
show create table t4;
Table Create Table
t4 CREATE TABLE `t4` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST (month(a))
SUBPARTITION BY KEY (a)
SUBPARTITIONS 3
(PARTITION quarter1 VALUES IN (0,1,2,3) ENGINE = InnoDB,
PARTITION quarter2 VALUES IN (4,5,6) ENGINE = InnoDB,
PARTITION quarter3 VALUES IN (7,8,9) ENGINE = InnoDB,
PARTITION quarter4 VALUES IN (10,11,12) ENGINE = InnoDB) */
12 inserts;
insert into t4 values (date_add('1970-01-01 00:00:00',interval 12-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 11-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 10-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 9-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 8-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 7-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 6-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 5-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 4-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 3-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 2-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 1-1 month));
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select count(*) from t4;
count(*)
12
select * from t4;
a
0000-00-00 00:00:00
1970-02-01 00:00:00
1970-03-01 00:00:00
1970-04-01 00:00:00
1970-05-01 00:00:00
1970-06-01 00:00:00
1970-07-01 00:00:00
1970-08-01 00:00:00
1970-09-01 00:00:00
1970-10-01 00:00:00
1970-11-01 00:00:00
1970-12-01 00:00:00
drop table t4;
create table t1 (a date not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,

View file

@ -184,114 +184,6 @@ a
1971-01-01 00:00:58
1971-01-01 00:00:59
drop table t2;
create table t3 (a timestamp not null, primary key(a)) engine='MyISAM'
partition by range (month(a)) subpartition by key (a)
subpartitions 3 (
partition quarter1 values less than (4),
partition quarter2 values less than (7),
partition quarter3 values less than (10),
partition quarter4 values less than (13)
);
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (month(a))
SUBPARTITION BY KEY (a)
SUBPARTITIONS 3
(PARTITION quarter1 VALUES LESS THAN (4) ENGINE = MyISAM,
PARTITION quarter2 VALUES LESS THAN (7) ENGINE = MyISAM,
PARTITION quarter3 VALUES LESS THAN (10) ENGINE = MyISAM,
PARTITION quarter4 VALUES LESS THAN (13) ENGINE = MyISAM) */
12 inserts;
insert into t3 values (date_add('1970-01-01 00:00:00',interval 12-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 11-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 10-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 9-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 8-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 7-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 6-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 5-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 4-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 3-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 2-1 month));
insert into t3 values (date_add('1970-01-01 00:00:00',interval 1-1 month));
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select count(*) from t3;
count(*)
12
select * from t3;
a
0000-00-00 00:00:00
1970-02-01 00:00:00
1970-03-01 00:00:00
1970-04-01 00:00:00
1970-05-01 00:00:00
1970-06-01 00:00:00
1970-07-01 00:00:00
1970-08-01 00:00:00
1970-09-01 00:00:00
1970-10-01 00:00:00
1970-11-01 00:00:00
1970-12-01 00:00:00
drop table t3;
create table t4 (a timestamp not null, primary key(a)) engine='MyISAM'
partition by list (month(a)) subpartition by key (a)
subpartitions 3 (
partition quarter1 values in (0,1,2,3),
partition quarter2 values in (4,5,6),
partition quarter3 values in (7,8,9),
partition quarter4 values in (10,11,12)
);
show create table t4;
Table Create Table
t4 CREATE TABLE `t4` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST (month(a))
SUBPARTITION BY KEY (a)
SUBPARTITIONS 3
(PARTITION quarter1 VALUES IN (0,1,2,3) ENGINE = MyISAM,
PARTITION quarter2 VALUES IN (4,5,6) ENGINE = MyISAM,
PARTITION quarter3 VALUES IN (7,8,9) ENGINE = MyISAM,
PARTITION quarter4 VALUES IN (10,11,12) ENGINE = MyISAM) */
12 inserts;
insert into t4 values (date_add('1970-01-01 00:00:00',interval 12-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 11-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 10-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 9-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 8-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 7-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 6-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 5-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 4-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 3-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 2-1 month));
insert into t4 values (date_add('1970-01-01 00:00:00',interval 1-1 month));
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select count(*) from t4;
count(*)
12
select * from t4;
a
0000-00-00 00:00:00
1970-02-01 00:00:00
1970-03-01 00:00:00
1970-04-01 00:00:00
1970-05-01 00:00:00
1970-06-01 00:00:00
1970-07-01 00:00:00
1970-08-01 00:00:00
1970-09-01 00:00:00
1970-10-01 00:00:00
1970-11-01 00:00:00
1970-12-01 00:00:00
drop table t4;
create table t1 (a date not null, primary key(a)) engine='MyISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,

View file

@ -169,4 +169,77 @@ DROP USER 'create_rout_db'@'localhost';
call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
USE mtr;
call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
######## BUG#49119 #######
### i) test case from the 'how to repeat section'
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(c1 INT);
CREATE PROCEDURE p1() SELECT * FROM t1 |
REVOKE EXECUTE ON PROCEDURE p1 FROM 'root'@'localhost';
ERROR 42000: There is no such grant defined for user 'root' on host 'localhost' on routine 'p1'
DROP TABLE t1;
DROP PROCEDURE p1;
### ii) Test case in which REVOKE partially succeeds
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(c1 INT);
CREATE PROCEDURE p1() SELECT * FROM t1 |
CREATE USER 'user49119'@'localhost';
GRANT EXECUTE ON PROCEDURE p1 TO 'user49119'@'localhost';
##############################################################
### Showing grants for both users: root and user49119 (master)
SHOW GRANTS FOR 'user49119'@'localhost';
Grants for user49119@localhost
GRANT USAGE ON *.* TO 'user49119'@'localhost'
GRANT EXECUTE ON PROCEDURE `test`.`p1` TO 'user49119'@'localhost'
SHOW GRANTS FOR CURRENT_USER;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
##############################################################
##############################################################
### Showing grants for both users: root and user49119 (master)
SHOW GRANTS FOR 'user49119'@'localhost';
Grants for user49119@localhost
GRANT USAGE ON *.* TO 'user49119'@'localhost'
GRANT EXECUTE ON PROCEDURE `test`.`p1` TO 'user49119'@'localhost'
SHOW GRANTS FOR CURRENT_USER;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
##############################################################
## This statement will make the revoke fail because root has no
## execute grant. However, it will still revoke the grant for
## user49119.
REVOKE EXECUTE ON PROCEDURE p1 FROM 'user49119'@'localhost', 'root'@'localhost';
ERROR 42000: There is no such grant defined for user 'root' on host 'localhost' on routine 'p1'
##############################################################
### Showing grants for both users: root and user49119 (master)
### after revoke statement failure
SHOW GRANTS FOR 'user49119'@'localhost';
Grants for user49119@localhost
GRANT USAGE ON *.* TO 'user49119'@'localhost'
SHOW GRANTS FOR CURRENT_USER;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
##############################################################
#############################################################
### Showing grants for both users: root and user49119 (slave)
### after revoke statement failure (should match
SHOW GRANTS FOR 'user49119'@'localhost';
Grants for user49119@localhost
GRANT USAGE ON *.* TO 'user49119'@'localhost'
SHOW GRANTS FOR CURRENT_USER;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
##############################################################
DROP TABLE t1;
DROP PROCEDURE p1;
DROP USER 'user49119'@'localhost';
"End of test"

View file

@ -63,7 +63,7 @@ source include/diff_master_slave.inc;
DROP DATABASE d1;
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP DATABASE d2;
DROP DATABASE IF EXISTS d2;
source include/kill_query.inc;
source include/diff_master_slave.inc;
CREATE EVENT e2
@ -115,6 +115,7 @@ source include/diff_master_slave.inc;
DROP INDEX i1 on t1;
source include/kill_query.inc;
source include/diff_master_slave.inc;
CREATE TABLE IF NOT EXISTS t4 (a int);
CREATE TRIGGER tr2 BEFORE INSERT ON t4
FOR EACH ROW BEGIN
DELETE FROM t1 WHERE a=NEW.a;

View file

@ -34,47 +34,9 @@ insert into t1 values(1,10);
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
set global sql_slave_skip_counter=1;
start slave;
show slave status;;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 2010
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 2010
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 1
Last_SQL_Errno=0
Last_SQL_Error
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
@ -82,47 +44,9 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t1;
stop slave;
change master to master_user='test';
change master to master_user='root';
show slave status;;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 2045
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running No
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 2045
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 1
Last_SQL_Errno=0
Last_SQL_Error
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
@ -131,47 +55,9 @@ set sql_log_bin=1;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
stop slave;
reset slave;
show slave status;;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File
Read_Master_Log_Pos 4
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File
Slave_IO_Running No
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 0
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 1
Last_SQL_Errno=0
Last_SQL_Error
reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=MyISAM;

View file

@ -0,0 +1,128 @@
CREATE TABLE t1 (c1 char(50));
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
LOAD DATA CONCURRENT INFILE '../../std_data/words.dat' INTO TABLE t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (c1 char(50))
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (c1) ;file_id=#
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA CONCURRENT INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (c1) ;file_id=#
DROP TABLE t1;
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;
reset master;
select last_insert_id();
last_insert_id()
0
create table t1(a int not null auto_increment, b int, primary key(a) );
load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1;
select last_insert_id();
last_insert_id()
1
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
load data CONCURRENT infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
select * from t1;
a b
1 10
2 15
select * from t3;
day id category name
2003-02-22 2461 b a a a @ %  ' " a
2003-03-22 2161 c asdf
2003-03-22 2416 a bbbbb
drop table t1;
drop table t2;
drop table t3;
create table t1(a int, b int, unique(b));
insert into t1 values(1,10);
load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1;
set global sql_slave_skip_counter=1;
start slave;
Last_SQL_Errno=0
Last_SQL_Error
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1;
stop slave;
change master to master_user='test';
change master to master_user='root';
Last_SQL_Errno=0
Last_SQL_Error
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1;
stop slave;
reset slave;
Last_SQL_Errno=0
Last_SQL_Error
reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=MyISAM;
load data CONCURRENT infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
select * from t2;
day id category name
2003-02-22 2461 b a a a @ %  ' " a
2003-03-22 2161 c asdf
start slave;
select * from t2;
day id category name
2003-02-22 2461 b a a a @ %  ' " a
2003-03-22 2161 c asdf
alter table t2 drop key day;
delete from t2;
load data CONCURRENT infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
drop table t1, t2;
drop table t1, t2;
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
LOAD DATA CONCURRENT INFILE "../../std_data/words.dat" INTO TABLE t1;
ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY'
DROP TABLE IF EXISTS t1;
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 b48297_db1;
drop database if exists b42897_db2;
create database b48297_db1;
create database b42897_db2;
use b48297_db1;
CREATE TABLE t1 (c1 VARCHAR(256)) engine=MyISAM;;
use b42897_db2;
### assertion: works with cross-referenced database
LOAD DATA CONCURRENT LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
use b48297_db1;
### assertion: works with fully qualified name on current database
LOAD DATA CONCURRENT LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
### assertion: works without fully qualified name on current database
LOAD DATA CONCURRENT LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1;
### create connection without default database
### connect (conn2,localhost,root,,*NO-ONE*);
### assertion: works without stating the default database
LOAD DATA CONCURRENT LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
### disconnect and switch back to master connection
use b48297_db1;
Comparing tables master:b48297_db1.t1 and slave:b48297_db1.t1
DROP DATABASE b48297_db1;
DROP DATABASE b42897_db2;

View file

@ -220,3 +220,31 @@ start slave sql_thread;
start slave until master_log_file='master-bin.000001', master_log_pos=776;
Warnings:
Note 1254 Slave is already running
include/stop_slave.inc
drop table if exists t1;
reset slave;
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
drop table if exists t1;
reset master;
create table t1 (a int primary key auto_increment);
start slave;
include/stop_slave.inc
master and slave are in sync now
select 0 as zero;
zero
0
insert into t1 set a=null;
insert into t1 set a=null;
select count(*) as two from t1;
two
2
start slave until master_log_file='master-bin.000001', master_log_pos= UNTIL_POS;;
slave stopped at the prescribed position
select 0 as zero;
zero
0
select count(*) as one from t1;
one
1
drop table t1;
start slave;

View file

@ -36,8 +36,10 @@ ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) fo
SELECT @@session.sql_select_limit = @save_select_limit;
@@session.sql_select_limit = @save_select_limit
1
SET @save_conn_id= connection_id();
SET @@session.pseudo_thread_id=100;
SET @@session.pseudo_thread_id=connection_id();
SET @@session.pseudo_thread_id=@save_conn_id;
SET @@session.sql_log_bin=0;
SET @@session.sql_log_bin=1;
drop table if exists t1,t2;

View file

@ -52,10 +52,10 @@ purge binary logs to 'master-bin.000001';
--disable_query_log
call mtr.add_suppression("Failed to locate old binlog or relay log files");
call mtr.add_suppression("MYSQL_LOG::purge_logs was called with file ./master-bin.000001 not listed in the index");
call mtr.add_suppression("MYSQL_BIN_LOG::purge_logs was called with file ./master-bin.000001 not listed in the index");
connection slave;
call mtr.add_suppression("Failed to locate old binlog or relay log files");
call mtr.add_suppression("MYSQL_LOG::purge_logs was called with file ./master-bin.000001 not listed in the index");
call mtr.add_suppression("MYSQL_BIN_LOG::purge_logs was called with file ./master-bin.000001 not listed in the index");
--enable_query_log
--echo End of the tests

View file

@ -236,16 +236,7 @@ COMMIT;
--connection master_a
--enable_query_log
--let $wait_condition= SELECT COUNT(*)=400 FROM t2 WHERE c = 1
--connection master_a
--source include/wait_condition.inc
--connection master_b
--source include/wait_condition.inc
--connection master_c
--source include/wait_condition.inc
--connection master_d
--source include/wait_condition.inc
--source include/circular_rpl_for_4_hosts_sync.inc
--connection master_a
SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
@ -285,15 +276,7 @@ ROLLBACK;
--connection master_a
--enable_query_log
--let $wait_condition= SELECT COUNT(*)=200 FROM t2 WHERE c = 2
--connection master_a
--source include/wait_condition.inc
--connection master_b
--source include/wait_condition.inc
--connection master_c
--source include/wait_condition.inc
--connection master_d
--source include/wait_condition.inc
--source include/circular_rpl_for_4_hosts_sync.inc
--connection master_a
SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;

View file

@ -208,4 +208,104 @@ connection slave;
USE mtr;
call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
# BUG#49119: Master crashes when executing 'REVOKE ... ON
# {PROCEDURE|FUNCTION} FROM ...'
#
# The tests are divided into two test cases:
#
# i) a test case that mimics the one in the bug report.
#
# - We show that, despite the fact, that a revoke command fails
# when binlogging is active, the master will not hit an
# assertion.
#
# ii) a test case that partially succeeds on the master will also
# partially succeed on the slave.
#
# - The revoke statement that partially succeeds tries to revoke
# an EXECUTE grant for two users, and only one of the user has
# the specific grant. This will cause mysql to drop one of the
# grants and report error for the statement. The slave should
# also drop the grants that the master succeed and the SQL
# thread should not stop on statement failure.
-- echo ######## BUG#49119 #######
-- echo ### i) test case from the 'how to repeat section'
-- source include/master-slave-reset.inc
-- connection master
CREATE TABLE t1(c1 INT);
DELIMITER |;
CREATE PROCEDURE p1() SELECT * FROM t1 |
DELIMITER ;|
-- error ER_NONEXISTING_PROC_GRANT
REVOKE EXECUTE ON PROCEDURE p1 FROM 'root'@'localhost';
-- sync_slave_with_master
-- connection master
DROP TABLE t1;
DROP PROCEDURE p1;
-- sync_slave_with_master
-- echo ### ii) Test case in which REVOKE partially succeeds
-- connection master
-- source include/master-slave-reset.inc
-- connection master
CREATE TABLE t1(c1 INT);
DELIMITER |;
CREATE PROCEDURE p1() SELECT * FROM t1 |
DELIMITER ;|
CREATE USER 'user49119'@'localhost';
GRANT EXECUTE ON PROCEDURE p1 TO 'user49119'@'localhost';
-- echo ##############################################################
-- echo ### Showing grants for both users: root and user49119 (master)
SHOW GRANTS FOR 'user49119'@'localhost';
SHOW GRANTS FOR CURRENT_USER;
-- echo ##############################################################
-- sync_slave_with_master
-- echo ##############################################################
-- echo ### Showing grants for both users: root and user49119 (master)
SHOW GRANTS FOR 'user49119'@'localhost';
SHOW GRANTS FOR CURRENT_USER;
-- echo ##############################################################
-- connection master
-- echo ## This statement will make the revoke fail because root has no
-- echo ## execute grant. However, it will still revoke the grant for
-- echo ## user49119.
-- error ER_NONEXISTING_PROC_GRANT
REVOKE EXECUTE ON PROCEDURE p1 FROM 'user49119'@'localhost', 'root'@'localhost';
-- echo ##############################################################
-- echo ### Showing grants for both users: root and user49119 (master)
-- echo ### after revoke statement failure
SHOW GRANTS FOR 'user49119'@'localhost';
SHOW GRANTS FOR CURRENT_USER;
-- echo ##############################################################
-- sync_slave_with_master
-- echo #############################################################
-- echo ### Showing grants for both users: root and user49119 (slave)
-- echo ### after revoke statement failure (should match
SHOW GRANTS FOR 'user49119'@'localhost';
SHOW GRANTS FOR CURRENT_USER;
-- echo ##############################################################
-- connection master
DROP TABLE t1;
DROP PROCEDURE p1;
DROP USER 'user49119'@'localhost';
-- sync_slave_with_master
--echo "End of test"

View file

@ -153,7 +153,7 @@ source include/kill_query_and_diff_master_slave.inc;
send DROP DATABASE d1;
source include/kill_query_and_diff_master_slave.inc;
send DROP DATABASE d2;
send DROP DATABASE IF EXISTS d2;
source include/kill_query_and_diff_master_slave.inc;
######## EVENT ########
@ -226,7 +226,7 @@ source include/kill_query_and_diff_master_slave.inc;
send DROP PROCEDURE p1;
source include/kill_query_and_diff_master_slave.inc;
# Temporarily disabled, see comment above for DROP FUNCTION IF EXISTS
# Temporarily disabled because of bug#43353, see comment above for DROP FUNCTION IF EXISTS
#send DROP PROCEDURE IF EXISTS p2;
#source include/kill_query_and_diff_master_slave.inc;
@ -277,6 +277,11 @@ source include/kill_query_and_diff_master_slave.inc;
######## TRIGGER ########
# Make sure table t4 exists
connection master;
CREATE TABLE IF NOT EXISTS t4 (a int);
connection master1;
let $diff_statement= SHOW TRIGGERS LIKE 'v%';
DELIMITER //;

View file

@ -0,0 +1,13 @@
-- source include/not_ndb_default.inc
-- source include/have_log_bin.inc
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
CREATE TABLE t1 (c1 char(50));
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
LOAD DATA CONCURRENT INFILE '../../std_data/words.dat' INTO TABLE t1;
-- source include/show_binlog_events.inc
DROP TABLE t1;
let $lock_option= CONCURRENT;
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_loaddata.test

View file

@ -101,3 +101,67 @@ start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
start slave sql_thread;
start slave until master_log_file='master-bin.000001', master_log_pos=776;
#
# bug#47210 first execution of "start slave until" stops too early
#
# testing that a slave rotate event that is caused by stopping the slave
# does not intervene anymore in UNTIL condition.
#
connection slave;
source include/stop_slave.inc;
--disable_warnings
drop table if exists t1;
--enable_warnings
reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
connection master;
--disable_warnings
drop table if exists t1;
--enable_warnings
reset master;
create table t1 (a int primary key auto_increment);
save_master_pos;
let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
connection slave;
start slave;
sync_with_master;
# at this point slave will close the relay log stamping it with its own
# Rotate log event. This event won't be examined on matter of the master
# UNTIL pos anymore.
source include/stop_slave.inc;
let $slave_exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
--echo master and slave are in sync now
let $diff_pos= `select $master_pos - $slave_exec_pos`;
eval select $diff_pos as zero;
connection master;
insert into t1 set a=null;
let $until_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
insert into t1 set a=null;
select count(*) as two from t1;
connection slave;
--replace_result $until_pos UNTIL_POS;
eval start slave until master_log_file='master-bin.000001', master_log_pos= $until_pos;
source include/wait_for_slave_sql_to_stop.inc;
let $slave_exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
--echo slave stopped at the prescribed position
let $diff_pos= `select $until_pos - $slave_exec_pos`;
eval select $diff_pos as zero;
select count(*) as one from t1;
connection master;
drop table t1;
connection slave;
start slave;
sync_with_master;
# End of tests

View file

@ -115,8 +115,10 @@ SET @@session.sql_select_limit=10, @@session.sql_log_bin=0;
SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed
# Now as root, to be sure it works
connection con2;
SET @save_conn_id= connection_id();
SET @@session.pseudo_thread_id=100;
SET @@session.pseudo_thread_id=connection_id();
SET @@session.pseudo_thread_id=@save_conn_id;
SET @@session.sql_log_bin=0;
SET @@session.sql_log_bin=1;

View file

@ -179,8 +179,11 @@ insert into t1 values('2008-12-23 19:39:39',1);
--connection master1
SET @@session.time_zone='+02:00';
insert delayed into t1 values ('2008-12-23 19:39:39',2);
# Forces table t1 to be closed and flushes the query cache.
# This makes sure that 'delayed insert' is executed before next statement.
# wait for the delayed insert to be executed
let $wait_condition= SELECT date FROM t1 WHERE a=2;
--source include/wait_condition.inc
flush table t1;
flush logs;
select * from t1;

View file

@ -14,6 +14,16 @@ SET character_set_connection=ucs2;
SET CHARACTER SET koi8r;
#
# BUG#49028, error in LIKE with ucs2
#
create table t1 (a varchar(2) character set ucs2 collate ucs2_bin, key(a));
insert into t1 values ('A'),('A'),('B'),('C'),('D'),('A\t');
insert into t1 values ('A\0'),('A\0'),('A\0'),('A\0'),('AZ');
select hex(a) from t1 where a like 'A_' order by a;
select hex(a) from t1 ignore key(a) where a like 'A_' order by a;
drop table t1;
#
# Check that 0x20 is only trimmed when it is
# a part of real SPACE character, not just a part

View file

@ -1411,6 +1411,16 @@ select hex(_utf8 B'001111111111');
--error ER_INVALID_CHARACTER_STRING
select (_utf8 X'616263FF');
--echo #
--echo # Bug#44131 Binary-mode "order by" returns records in incorrect order for UTF-8 strings
--echo #
CREATE TABLE t1 (id int not null primary key, name varchar(10)) character set utf8;
INSERT INTO t1 VALUES
(2,'一二三01'),(3,'一二三09'),(4,'一二三02'),(5,'一二三08'),
(6,'一二三11'),(7,'一二三91'),(8,'一二三21'),(9,'一二三81');
SELECT * FROM t1 ORDER BY BINARY(name);
DROP TABLE t1;
#
# Bug #36772: When using UTF8, CONVERT with GROUP BY returns truncated results
#

View file

@ -10,7 +10,7 @@
#
##############################################################################
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
rpl_killed_ddl : Bug#45520: rpl_killed_ddl fails sporadically in pb2
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadicallyr
innodb-autoinc : Bug#49267 2009-12-02 test fails on windows because of different case mode
innodb : Bug#49396 2009-12-03 test fails in embedded mode
plugin_load : Bug#42144 2009-12-21 alik plugin_load fails

View file

@ -1,22 +0,0 @@
#
# Simple test for the example storage engine
# Taken fromm the select test
#
-- source include/have_exampledb.inc
--disable_warnings
# Clean up if event's test fails
drop database if exists events_test;
drop database if exists events_test2;
drop table if exists t1;
--enable_warnings
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
) ENGINE=example;
drop table t1;
# End of 4.1 tests

View file

@ -494,6 +494,27 @@ EXECUTE s;
DEALLOCATE PREPARE s;
DROP TABLE t1;
--echo #
--echo # Bug #49250 : spatial btree index corruption and crash
--echo # Part two : fulltext syntax check
--echo #
--error ER_PARSE_ERROR
CREATE TABLE t1(col1 TEXT,
FULLTEXT INDEX USING BTREE (col1));
CREATE TABLE t2(col1 TEXT);
--error ER_PARSE_ERROR
CREATE FULLTEXT INDEX USING BTREE ON t2(col);
--error ER_PARSE_ERROR
ALTER TABLE t2 ADD FULLTEXT INDEX USING BTREE (col1);
DROP TABLE t2;
--echo End of 5.0 tests
--echo #
--echo # Bug #47930: MATCH IN BOOLEAN MODE returns too many results
--echo # inside subquery

View file

@ -1320,6 +1320,39 @@ explain select 1 as a from t1,(select encode(f1,f1) as b from t1) a;
drop table t1;
--echo #
--echo # Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1 (a VARCHAR(20), b INT);
CREATE TABLE t2 (a VARCHAR(20), b INT);
INSERT INTO t1 VALUES ('ABC', 1);
INSERT INTO t2 VALUES ('ABC', 1);
SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a)
FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b;
SELECT DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a)
FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b;
SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC')
FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b;
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
INSERT INTO t1 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1);
INSERT INTO t2 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1);
SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a)
FROM t2 WHERE t2.b = 1 GROUP BY t2.b;
DROP TABLE t1, t2;
--echo Start of 5.4 tests
#

View file

@ -670,6 +670,21 @@ SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
DROP TABLE t1;
--echo #
--echo # Bug #49250 : spatial btree index corruption and crash
--echo # Part one : spatial syntax check
--echo #
--error ER_PARSE_ERROR
CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL,
SPATIAL INDEX USING BTREE (col1));
CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL);
--error ER_PARSE_ERROR
CREATE SPATIAL INDEX USING BTREE ON t2(col);
--error ER_PARSE_ERROR
ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1);
DROP TABLE t2;
--echo End of 5.0 tests

View file

@ -867,3 +867,32 @@ SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL;
DROP TABLE t1,t2;
--echo #
--echo # Bug#47650: using group by with rollup without indexes returns incorrect
--echo # results with where
--echo #
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 ( a INT, b INT );
INSERT INTO t2 VALUES (1, 1),(1, 2),(1, 3),(2, 4),(2, 5);
EXPLAIN
SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
FROM t1 LEFT JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
FROM t1 LEFT JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
EXPLAIN
SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
FROM t1 JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
FROM t1 JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
DROP TABLE t1, t2;

View file

@ -625,9 +625,11 @@ let $wait_condition=
--source include/wait_condition.inc
let $tlwb= `show status like 'Table_locks_waited'`;
unlock tables;
connection waiter;
--reap
connection default;
drop table t1;
disconnect waiter;
connection default;
--disable_query_log
eval SET @tlwa= SUBSTRING_INDEX('$tlwa', ' ', -1);
eval SET @tlwb= SUBSTRING_INDEX('$tlwb', ' ', -1);

View file

@ -1186,6 +1186,20 @@ SELECT a FROM t1;
CHECK TABLE t1;
DROP TABLE t1;
--echo #
--echo # Bug #49465: valgrind warnings and incorrect live checksum...
--echo #
CREATE TABLE t1(
a VARCHAR(1), b VARCHAR(1), c VARCHAR(1),
f VARCHAR(1), g VARCHAR(1), h VARCHAR(1),
i VARCHAR(1), j VARCHAR(1), k VARCHAR(1)) CHECKSUM=1;
INSERT INTO t1 VALUES('', '', '', '', '', '', '', '', '');
CHECKSUM TABLE t1 QUICK;
CHECKSUM TABLE t1 EXTENDED;
DROP TABLE t1;
--echo End of 5.0 tests

View file

@ -90,6 +90,24 @@ set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
eval set GLOBAL sql_mode=default;
--echo #
--echo # Bug #41569 mysql_upgrade (ver 5.1) add 3 fields to mysql.proc table
--echo # but does not set values.
--echo #
# Create a stored procedure and set the fields in question to null.
# When running mysql_upgrade, a warning should be written.
CREATE PROCEDURE testproc() BEGIN END;
UPDATE mysql.proc SET character_set_client = NULL WHERE name LIKE 'testproc';
UPDATE mysql.proc SET collation_connection = NULL WHERE name LIKE 'testproc';
UPDATE mysql.proc SET db_collation = NULL WHERE name LIKE 'testproc';
--exec $MYSQL_UPGRADE --skip-verbose --force 2> $MYSQLTEST_VARDIR/tmp/41569.txt
CALL testproc();
DROP PROCEDURE testproc;
--cat_file $MYSQLTEST_VARDIR/tmp/41569.txt
--remove_file $MYSQLTEST_VARDIR/tmp/41569.txt
#
# Test the --upgrade-system-tables option
#

View file

@ -886,6 +886,15 @@ SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
--echo # Must return 1 row
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
# part 2 of the problem : DESC test cases
--echo # Must use ref-or-null on the a_c index
--replace_column 1 x 2 x 3 x 6 x 7 x 8 x 9 x 10 x
EXPLAIN
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC;
--echo # Must return 1 row
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC;
DROP TABLE t1;

View file

@ -53,8 +53,8 @@ CREATE TABLE t1 (
b varchar(10),
PRIMARY KEY (a)
)
PARTITION BY RANGE (to_days(a)) (
PARTITION p1 VALUES LESS THAN (733407),
PARTITION BY RANGE (UNIX_TIMESTAMP(a)) (
PARTITION p1 VALUES LESS THAN (1199134800),
PARTITION pmax VALUES LESS THAN MAXVALUE
);
@ -64,7 +64,7 @@ INSERT INTO t1 VALUES ('2009-09-21 17:31:42', 'pmax');
SELECT * FROM t1;
ALTER TABLE t1 REORGANIZE PARTITION pmax INTO (
PARTITION p3 VALUES LESS THAN (733969),
PARTITION p3 VALUES LESS THAN (1247688000),
PARTITION pmax VALUES LESS THAN MAXVALUE);
SELECT * FROM t1;
SHOW CREATE TABLE t1;

View file

@ -158,7 +158,7 @@ create table t1 (col1 datetime)
partition by range(timestampdiff(day,5,col1))
(partition p0 values less than (10), partition p1 values less than (30));
-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-- error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
create table t1 (col1 date)
partition by range(unix_timestamp(col1))
(partition p0 values less than (10), partition p1 values less than (30));

View file

@ -23,6 +23,23 @@ partition by range columns (a,b,c)
( partition p0 values less than (1, maxvalue, 10),
partition p1 values less than (1, maxvalue, maxvalue));
#
# BUG#48737, Search fails with ucs2
#
create table t1 (a varchar(5) character set ucs2 collate ucs2_bin)
partition by range columns (a)
(partition p0 values less than (0x0041));
insert into t1 values (0x00410000);
select hex(a) from t1 where a like 'A_';
explain partitions select hex(a) from t1 where a like 'A_';
alter table t1 remove partitioning;
select hex(a) from t1 where a like 'A_';
create index a on t1 (a);
select hex(a) from t1 where a like 'A_';
insert into t1 values ('A_');
select hex(a) from t1;
drop table t1;
#
# BUG#48161, Delivering too few records using collate syntax with partitions
#

View file

@ -466,7 +466,7 @@ partitions 2
#
# Partition by range, constant partition function not allowed
#
--error ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (
a int not null,
b int not null,
@ -681,7 +681,7 @@ partition by list (a);
#
# Partition by list, constant partition function not allowed
#
--error ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (
a int not null,
b int not null,
@ -840,4 +840,364 @@ partition by range (a + (select count(*) from t1))
create table t1 (a char(10))
partition by hash (extractvalue(a,'a'));
--echo #
--echo # Bug #42849: innodb crash with varying time_zone on partitioned
--echo # timestamp primary key
--echo #
# A correctly partitioned table to test that trying to repartition it using
# timezone-dependent expression will throw an error.
CREATE TABLE old (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (UNIX_TIMESTAMP(a)) (
PARTITION p VALUES LESS THAN (1219089600),
PARTITION pmax VALUES LESS THAN MAXVALUE);
# Check that allowed arithmetic/math functions involving TIMESTAMP values result
# in ER_PARTITION_FUNC_NOT_ALLOWED_ERROR when used as a partitioning function
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
ALTER TABLE old
PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a+0) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (a+0) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a % 2) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (a % 2) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (ABS(a)) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (ABS(a)) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (CEILING(a)) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (CEILING(a)) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (FLOOR(a)) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (FLOOR(a)) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
# Check that allowed date/time functions involving TIMESTAMP values result
# in ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR when used as a partitioning function
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (TO_DAYS(a)) (
PARTITION p VALUES LESS THAN (733638),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (TO_DAYS(a)) (
PARTITION p VALUES LESS THAN (733638),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (DAYOFYEAR(a)) (
PARTITION p VALUES LESS THAN (231),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (DAYOFYEAR(a)) (
PARTITION p VALUES LESS THAN (231),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (DAYOFMONTH(a)) (
PARTITION p VALUES LESS THAN (19),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (DAYOFMONTH(a)) (
PARTITION p VALUES LESS THAN (19),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (DAYOFWEEK(a)) (
PARTITION p VALUES LESS THAN (3),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (DAYOFWEEK(a)) (
PARTITION p VALUES LESS THAN (3),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (MONTH(a)) (
PARTITION p VALUES LESS THAN (8),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (MONTH(a)) (
PARTITION p VALUES LESS THAN (8),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (HOUR(a)) (
PARTITION p VALUES LESS THAN (17),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (HOUR(a)) (
PARTITION p VALUES LESS THAN (17),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (MINUTE(a)) (
PARTITION p VALUES LESS THAN (55),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (MINUTE(a)) (
PARTITION p VALUES LESS THAN (55),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (QUARTER(a)) (
PARTITION p VALUES LESS THAN (3),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (QUARTER(a)) (
PARTITION p VALUES LESS THAN (3),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (SECOND(a)) (
PARTITION p VALUES LESS THAN (7),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (SECOND(a)) (
PARTITION p VALUES LESS THAN (7),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (YEARWEEK(a)) (
PARTITION p VALUES LESS THAN (200833),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (YEARWEEK(a)) (
PARTITION p VALUES LESS THAN (200833),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (YEAR(a)) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (YEAR(a)) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (WEEKDAY(a)) (
PARTITION p VALUES LESS THAN (3),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (WEEKDAY(a)) (
PARTITION p VALUES LESS THAN (3),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (TIME_TO_SEC(a)) (
PARTITION p VALUES LESS THAN (64507),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (TIME_TO_SEC(a)) (
PARTITION p VALUES LESS THAN (64507),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (EXTRACT(DAY FROM a)) (
PARTITION p VALUES LESS THAN (18),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (EXTRACT(DAY FROM a)) (
PARTITION p VALUES LESS THAN (18),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL, b TIMESTAMP NOT NULL, PRIMARY KEY(a,b))
PARTITION BY RANGE (DATEDIFF(a, a)) (
PARTITION p VALUES LESS THAN (18),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (DATEDIFF(a, a)) (
PARTITION p VALUES LESS THAN (18),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (YEAR(a + 0)) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (YEAR(a + 0)) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (TO_DAYS(a + '2008-01-01')) (
PARTITION p VALUES LESS THAN (733638),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (TO_DAYS(a + '2008-01-01')) (
PARTITION p VALUES LESS THAN (733638),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (YEAR(a + '2008-01-01')) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (YEAR(a + '2008-01-01')) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ALTER TABLE old ADD COLUMN b DATE;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP, b DATE)
PARTITION BY RANGE (YEAR(a + b)) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (YEAR(a + b)) (
PARTITION p VALUES LESS THAN (2008),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP, b DATE)
PARTITION BY RANGE (TO_DAYS(a + b)) (
PARTITION p VALUES LESS THAN (733638),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (TO_DAYS(a + b)) (
PARTITION p VALUES LESS THAN (733638),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP, b date)
PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
PARTITION p VALUES LESS THAN (1219089600),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
PARTITION p VALUES LESS THAN (1219089600),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE new (a TIMESTAMP, b TIMESTAMP)
PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
PARTITION p VALUES LESS THAN (1219089600),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ALTER TABLE old MODIFY b TIMESTAMP;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE old
PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
PARTITION p VALUES LESS THAN (1219089600),
PARTITION pmax VALUES LESS THAN MAXVALUE);
DROP TABLE old;
--echo End of 5.1 tests

View file

@ -0,0 +1,251 @@
# Test of key cache with partitions
--source include/have_partition.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2, v, x;
--enable_warnings
--echo # Actual test of key caches
--echo # Verifing that reads/writes use the key cache correctly
SELECT @org_key_cache_buffer_size:= @@global.default.key_buffer_size;
--echo # Minimize default key cache (almost disabled).
SET @@global.default.key_buffer_size = 1;
CREATE TABLE t1 (
a INT,
b INT,
c INT NOT NULL,
PRIMARY KEY (a),
KEY `inx_b` (b))
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION p0 VALUES LESS THAN (1167602410)
(SUBPARTITION sp0,
SUBPARTITION sp1),
PARTITION p1 VALUES LESS THAN MAXVALUE
(SUBPARTITION sp2,
SUBPARTITION sp3));
CREATE TABLE t2 (
a INT,
b INT,
c INT NOT NULL,
PRIMARY KEY (a),
KEY `inx_b` (b));
FLUSH TABLES;
FLUSH STATUS;
# Genereate 4096 rows. Idea from:
# http://datacharmer.blogspot.com/2007/12/data-from-nothing-solution-to-pop-quiz.html
SET @a:=1167602400;
CREATE VIEW v AS SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4;
CREATE VIEW x AS SELECT 1 FROM v,v a,v b;
# due to I_S performance, this was substituted with include files which
# uses SHOW STATUS
#DELIMITER |;
#CREATE PROCEDURE was_zero_reads()
#BEGIN
# SELECT IF(VARIABLE_VALUE = 0,"Yes!","No!") as 'Was zero reads?'
# FROM INFORMATION_SCHEMA.SESSION_STATUS
# WHERE VARIABLE_NAME = 'KEY_READS';
# FLUSH STATUS;
#END|
#DELIMITER ;|
FLUSH STATUS;
INSERT t1 SELECT @a, @a * (1 - ((@a % 2) * 2)) , 1167612400 - (@a:=@a+1) FROM x, x y;
--source include/check_key_req.inc
--echo # row distribution:
SELECT PARTITION_NAME, SUBPARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA='test' and TABLE_NAME='t1';
DROP VIEW x;
DROP VIEW v;
FLUSH TABLES;
FLUSH STATUS;
SELECT COUNT(b) FROM t1 WHERE b >= 0;
--source include/check_key_reads.inc
INSERT t2 SELECT a,b,c FROM t1;
--source include/check_key_req.inc
FLUSH STATUS;
SELECT COUNT(b) FROM t2 WHERE b >= 0;
--source include/check_key_reads.inc
FLUSH TABLES;
--echo # Setting the default key cache to 1M
SET GLOBAL key_buffer_size = 1024*1024;
FLUSH STATUS;
--echo # All these have to read the indexes
LOAD INDEX INTO CACHE t1 PARTITION (p1);
--source include/check_key_reads.inc
SELECT COUNT(b) FROM t1 WHERE b >= 0;
--source include/check_key_reads.inc
SELECT COUNT(b) FROM t2 WHERE b >= 0;
--source include/check_key_reads.inc
--echo # All these should be able to use the key cache
SELECT COUNT(b) FROM t1 WHERE b >= 0;
--source include/check_key_reads.inc
SELECT COUNT(b) FROM t2 WHERE b >= 0;
--source include/check_key_reads.inc
FLUSH TABLES;
LOAD INDEX INTO CACHE t1 PARTITION (p1,p0);
--source include/check_key_reads.inc
--echo # should not be zero
SELECT COUNT(b) FROM t1 WHERE b >= 0;
--source include/check_key_reads.inc
LOAD INDEX INTO CACHE t2;
--source include/check_key_reads.inc
--echo # should not be zero
SELECT COUNT(b) FROM t2 WHERE b >= 0;
--source include/check_key_reads.inc
FLUSH TABLES;
LOAD INDEX INTO CACHE t1 PARTITION (p1,p0) IGNORE LEAVES;
--source include/check_key_reads.inc
--echo # should not be zero
SELECT COUNT(b) FROM t1 WHERE b >= 0;
--source include/check_key_reads.inc
LOAD INDEX INTO CACHE t2 IGNORE LEAVES;
--source include/check_key_reads.inc
--echo # should not be zero
SELECT COUNT(b) FROM t2 WHERE b >= 0;
--source include/check_key_reads.inc
TRUNCATE TABLE t2;
INSERT t2 SELECT a,b,c FROM t1;
--source include/check_key_req.inc
DROP TABLE t1,t2;
SET GLOBAL hot_cache.key_buffer_size = 1024*1024;
SET GLOBAL warm_cache.key_buffer_size = 1024*1024;
SET @@global.cold_cache.key_buffer_size = 1024*1024;
SELECT @@global.default.key_buffer_size a, @@global.default.key_cache_block_size b, @@global.default.key_cache_age_threshold c, @@global.default.key_cache_division_limit d;
SELECT @@global.hot_cache.key_buffer_size a, @@global.hot_cache.key_cache_block_size b, @@global.hot_cache.key_cache_age_threshold c, @@global.hot_cache.key_cache_division_limit d;
SELECT @@global.warm_cache.key_buffer_size a, @@global.warm_cache.key_cache_block_size b, @@global.warm_cache.key_cache_age_threshold c, @@global.warm_cache.key_cache_division_limit d;
SELECT @@global.cold_cache.key_buffer_size a, @@global.cold_cache.key_cache_block_size b, @@global.cold_cache.key_cache_age_threshold c, @@global.cold_cache.key_cache_division_limit d;
CREATE TABLE t1 (
a INT,
b VARCHAR(257),
c INT NOT NULL,
PRIMARY KEY (a),
KEY `inx_b` (b),
KEY `inx_c`(c))
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION p0 VALUES LESS THAN (10)
(SUBPARTITION sp0,
SUBPARTITION sp1),
PARTITION p1 VALUES LESS THAN MAXVALUE
(SUBPARTITION sp2,
SUBPARTITION sp3));
CREATE TABLE t2 (
a INT,
b VARCHAR(257),
c INT NOT NULL,
PRIMARY KEY (a),
KEY `inx_b` (b),
KEY `inx_c`(c));
SET @a:=1167602400;
# Genereate 4096 rows. Idea from:
# http://datacharmer.blogspot.com/2007/12/data-from-nothing-solution-to-pop-quiz.html
CREATE VIEW v AS SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4;
CREATE VIEW x AS SELECT 1 FROM v,v a,v b;
INSERT t1 SELECT @a, CONCAT('X_', @a, ' MySQL'), 1167612400 - (@a:=@a+1) FROM x, x a;
DROP VIEW x;
DROP VIEW v;
INSERT t2 SELECT a, b, c FROM t1;
SELECT COUNT(*) FROM t1;
SELECT COUNT(*) FROM t2;
FLUSH TABLES;
--echo # Restrict partitioned commands to partitioned tables only
--error ER_PARTITION_MGMT_ON_NONPARTITIONED
CACHE INDEX t2 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
--error ER_PARTITION_MGMT_ON_NONPARTITIONED
CACHE INDEX t2 PARTITION (p0,`p1`) INDEX (`PRIMARY`) IN hot_cache;
--error ER_PARTITION_MGMT_ON_NONPARTITIONED
CACHE INDEX t2 PARTITION (`p1`) INDEX (`PRIMARY`,`inx_b`) IN hot_cache;
--error ER_PARTITION_MGMT_ON_NONPARTITIONED
CACHE INDEX t2 PARTITION (ALL) KEY (`inx_b`,`PRIMARY`) IN hot_cache;
--echo # Basic key cache testing
--echo # The manual correctly says: "The syntax of CACHE INDEX enables you to
--echo # specify that only particular indexes from a table should be assigned
--echo # to the cache. The current implementation assigns all the table's
--echo # indexes to the cache, so there is no reason to specify anything
--echo # other than the table name."
--echo # So the most of the test only tests the syntax
CACHE INDEX t2 INDEX (`inx_b`) IN hot_cache;
CACHE INDEX t2 KEY (`PRIMARY`) IN warm_cache;
CACHE INDEX t2 KEY (`PRIMARY`,`inx_b`) IN cold_cache;
CACHE INDEX t2 INDEX (inx_b,`PRIMARY`) IN default;
CACHE INDEX t1 PARTITION (p0) KEY (`inx_b`) IN cold_cache;
--error ER_PARSE_ERROR
CACHE INDEX t1 PARTITIONS (p0) KEY (`inx_b`) IN cold_cache;
--echo # only one table at a time if specifying partitions
--error ER_PARSE_ERROR
CACHE INDEX t1,t2 PARTITION (p0) KEY (`inx_b`) IN cold_cache;
CACHE INDEX t1 PARTITION (`p0`,p1) INDEX (`PRIMARY`) IN warm_cache;
CACHE INDEX t1 PARTITION (`p1`) INDEX (`PRIMARY`,inx_b) IN hot_cache;
CACHE INDEX t1 PARTITION (ALL) KEY (`inx_b`,`PRIMARY`) IN default;
CACHE INDEX t1 PARTITION (ALL) IN hot_cache;
CACHE INDEX t1 INDEX (`inx_b`) IN default;
CACHE INDEX t1 KEY (`PRIMARY`) IN hot_cache;
CACHE INDEX t1 KEY (`PRIMARY`,`inx_b`) IN warm_cache;
CACHE INDEX t1 INDEX (`inx_b`,`PRIMARY`) IN cold_cache;
CACHE INDEX t1 IN hot_cache;
--echo # Test of non existent key cache:
--error ER_UNKNOWN_KEY_CACHE
CACHE INDEX t1 IN non_existent_key_cache;
--echo # Basic testing of LOAD INDEX
LOAD INDEX INTO CACHE t2;
--echo # PRIMARY and secondary keys have different block sizes
LOAD INDEX INTO CACHE t2 ignore leaves;
--echo # Must have INDEX or KEY before the index list
--error ER_PARSE_ERROR
LOAD INDEX INTO CACHE t2 (`PRIMARY`);
--echo # Test of IGNORE LEAVES
LOAD INDEX INTO CACHE t2 INDEX (`PRIMARY`);
LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_b`) IGNORE LEAVES;
CACHE INDEX t2 IN warm_cache;
CACHE INDEX t1 IN cold_cache;
LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`) IGNORE LEAVES;
CACHE INDEX t2 INDEX (`inx_b`, `inx_c`) IN hot_cache;
LOAD INDEX INTO CACHE t2 KEY (`inx_b`, `inx_c`) IGNORE LEAVES;
CACHE INDEX t2 IN warm_cache;
CACHE INDEX t2 INDEX (`PRIMARY`, `inx_c`) IN hot_cache;
LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_c`) IGNORE LEAVES;
CACHE INDEX t2 INDEX (`inx_b`,`PRIMARY`) IN default;
LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_b`);
CACHE INDEX t2 IN default;
LOAD INDEX INTO CACHE t2 IGNORE LEAVES;
--error ER_PARTITION_MGMT_ON_NONPARTITIONED
LOAD INDEX INTO CACHE t2 PARTITION (p1) INDEX (`PRIMARY`);
LOAD INDEX INTO CACHE t1, t2;
--echo # only one table at a time if specifying partitions
--error ER_PARSE_ERROR
LOAD INDEX INTO CACHE t1 PARTITION (p0), t2;
LOAD INDEX INTO CACHE t1 IGNORE LEAVES;
LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`);
LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`,`inx_b`) IGNORE LEAVES;
LOAD INDEX INTO CACHE t1 INDEX (`inx_b`) IGNORE LEAVES;
LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`) IGNORE LEAVES;
LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`,`inx_b`);
LOAD INDEX INTO CACHE t1 PARTITION (p1) INDEX (`PRIMARY`);
LOAD INDEX INTO CACHE t1 PARTITION (`p1`,p0) KEY (`PRIMARY`) IGNORE LEAVES;
LOAD INDEX INTO CACHE t1 PARTITION (ALL);
--error ER_PARSE_ERROR
LOAD INDEX INTO CACHE t1 PARTITIONS ALL;
LOAD INDEX INTO CACHE t1 PARTITION (p1,`p0`) IGNORE LEAVES;
DROP INDEX `inx_b` on t1;
DROP INDEX `inx_b` on t2;
--error ER_PARTITION_MGMT_ON_NONPARTITIONED
CACHE INDEX t2 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
CACHE INDEX t2 INDEX (`inx_b`) IN hot_cache;
CACHE INDEX t1 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
CACHE INDEX t1 INDEX (`inx_b`) IN hot_cache;
DROP TABLE t1,t2;
SET GLOBAL hot_cache.key_buffer_size = 0;
SET GLOBAL warm_cache.key_buffer_size = 0;
SET @@global.cold_cache.key_buffer_size = 0;
SELECT @@global.default.key_buffer_size a, @@global.default.key_cache_block_size b, @@global.default.key_cache_age_threshold c, @@global.default.key_cache_division_limit d;
SELECT @@global.hot_cache.key_buffer_size a, @@global.hot_cache.key_cache_block_size b, @@global.hot_cache.key_cache_age_threshold c, @@global.hot_cache.key_cache_division_limit d;
SELECT @@global.warm_cache.key_buffer_size a, @@global.warm_cache.key_cache_block_size b, @@global.warm_cache.key_cache_age_threshold c, @@global.warm_cache.key_cache_division_limit d;
SELECT @@global.cold_cache.key_buffer_size a, @@global.cold_cache.key_cache_block_size b, @@global.cold_cache.key_cache_age_threshold c, @@global.cold_cache.key_cache_division_limit d;
--disable_warnings
SET @@global.default.key_buffer_size = @org_key_cache_buffer_size;
--enable_warnings

View file

@ -9,6 +9,16 @@
drop table if exists t1, t2;
--enable_warnings
#
#BUG#49591, Add proper version number to SHOW CREATE TABLE
#
create table t1 (a int)
partition by range (a)
subpartition by hash(to_seconds(a))
(partition p0 values less than (1));
show create table t1;
drop table t1;
--error ER_NULL_IN_VALUES_LESS_THAN
create table t1 (a int)
partition by range (a)
@ -30,6 +40,7 @@ explain partitions select * from t1 where a < '2007-03-08 00:00:01';
explain partitions select * from t1 where a <= '2007-03-08 00:00:00';
explain partitions select * from t1 where a <= '2007-03-07 23:59:59';
explain partitions select * from t1 where a < '2007-03-07 23:59:59';
show create table t1;
drop table t1;
#
# New test cases for new function to_seconds
@ -44,6 +55,7 @@ explain partitions select * from t1 where a <= '2003-12-31';
select * from t1 where a <= '2003-12-31';
explain partitions select * from t1 where a <= '2005-01-01';
select * from t1 where a <= '2005-01-01';
show create table t1;
drop table t1;
create table t1 (a datetime)
@ -56,6 +68,7 @@ explain partitions select * from t1 where a <= '2004-01-01 11:59.59';
select * from t1 where a <= '2004-01-01 11:59:59';
explain partitions select * from t1 where a <= '2005-01-01';
select * from t1 where a <= '2005-01-01';
show create table t1;
drop table t1;
#

View file

@ -1991,6 +1991,29 @@ select @arg;
execute stmt using @arg;
deallocate prepare stmt;
--echo #
--echo # Bug#48508: Crash on prepared statement re-execution.
--echo #
create table t1(b int);
insert into t1 values (0);
create view v1 AS select 1 as a from t1 where b;
prepare stmt from "select * from v1 where a";
execute stmt;
execute stmt;
deallocate prepare stmt;
drop table t1;
drop view v1;
create table t1(a bigint);
create table t2(b tinyint);
insert into t2 values (null);
prepare stmt from "select 1 from t1 join t2 on a xor b where b > 1 and a =1";
execute stmt;
execute stmt;
deallocate prepare stmt;
drop table t1,t2;
--echo #
--echo End of 5.0 tests.
#
@ -3009,6 +3032,23 @@ execute stmt;
drop table t1;
deallocate prepare stmt;
--echo #
--echo # Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0
--echo #
prepare encode from "select encode(?, ?) into @ciphertext";
prepare decode from "select decode(?, ?) into @plaintext";
set @str="abc", @key="cba";
execute encode using @str, @key;
execute decode using @ciphertext, @key;
select @plaintext;
set @str="bcd", @key="dcb";
execute encode using @str, @key;
execute decode using @ciphertext, @key;
select @plaintext;
deallocate prepare encode;
deallocate prepare decode;
###########################################################################
--echo

View file

@ -94,10 +94,6 @@ select sql_cache * from t1 union select * from t1;
set query_cache_type=2;
select sql_cache * from t1 union select * from t1;
# all sql_cache statements, except for the first select, are ignored.
select * from t1 union select sql_cache * from t1;
select * from t1 where a IN (select sql_cache a from t1);
select * from t1 where a IN (select a from t1 union select sql_cache a from t1);
show status like "Qcache_hits";
show status like "Qcache_queries_in_cache";
set query_cache_type=on;
@ -110,15 +106,6 @@ show status like "Qcache_queries_in_cache";
# SELECT SQL_NO_CACHE
#
select sql_no_cache * from t1;
# sql_no_cache can occur in any nested select to turn on cacheing for the whole
# expression and it will always override a sql_cache statement.
select * from t1 union select sql_no_cache * from t1;
select * from t1 where a IN (select sql_no_cache a from t1);
select * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
select sql_cache sql_no_cache * from t1;
select sql_cache * from t1 union select sql_no_cache * from t1;
select sql_cache * from t1 where a IN (select sql_no_cache a from t1);
select sql_cache * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
show status like "Qcache_queries_in_cache";
drop table t1;
#
@ -1044,22 +1031,25 @@ set GLOBAL query_cache_size= default;
# Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached
#
set GLOBAL query_cache_size=1000000;
create table t1 (a char);
insert into t1 values ('c');
let $q1= `select RAND() from t1 union select sql_cache 1 from t1;`;
let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`;
# This syntax is no longer allowed, therefore the test case has been commented
# out.
# See test for Bug#35020 below.
#set GLOBAL query_cache_size=1000000;
#
#create table t1 (a char);
#insert into t1 values ('c');
#
#let $q1= `select RAND() from t1 union select sql_cache 1 from t1;`;
#let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`;
#
# disabling the logging of the query because the times are different each run.
--disable_query_log
eval select a from t1 where "$q1" = "$q2";
--enable_query_log
drop table t1;
set GLOBAL query_cache_size= default;
#--disable_query_log
#eval select a from t1 where "$q1" = "$q2";
#--enable_query_log
#
#drop table t1;
#
#set GLOBAL query_cache_size= default;
#
# Bug#29856: Insufficient buffer space led to a server crash.
@ -1307,5 +1297,69 @@ SELECT 1 FROM t1 GROUP BY
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
--echo End of 5.1 tests
#
# Bug#35020: illegal sql_cache select syntax
#
CREATE TABLE t1( a INT );
--error ER_PARSE_ERROR
SET @v = ( SELECT SQL_CACHE 1 );
--error ER_PARSE_ERROR
SET @v = ( SELECT SQL_NO_CACHE 1 );
#
# Keywords 'SQL_CACHE' and 'SQL_NO_CACHE' are allowed as column names.
# Hence the error messages are not intuitive.
#
--error ER_BAD_FIELD_ERROR
SELECT a FROM t1 WHERE a IN ( SELECT SQL_CACHE a FROM t1 );
--error ER_BAD_FIELD_ERROR
SELECT a FROM t1 WHERE a IN ( SELECT SQL_NO_CACHE a FROM t1 );
--error ER_BAD_FIELD_ERROR
SELECT ( SELECT SQL_CACHE a FROM t1 );
--error ER_BAD_FIELD_ERROR
SELECT ( SELECT SQL_NO_CACHE a FROM t1 );
SELECT SQL_CACHE * FROM t1;
SELECT SQL_NO_CACHE * FROM t1;
# SQL_CACHE is only allowed once in first top-level select.
--error ER_CANT_USE_OPTION_HERE
SELECT * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
--error ER_CANT_USE_OPTION_HERE
SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
--error ER_BAD_FIELD_ERROR
SELECT * FROM t1 WHERE a IN (SELECT SQL_CACHE a FROM t1);
--error ER_BAD_FIELD_ERROR
SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 UNION SELECT SQL_CACHE a FROM t1);
--error ER_CANT_USE_OPTION_HERE
SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
--error ER_BAD_FIELD_ERROR
SELECT * FROM t1 WHERE a IN (SELECT SQL_NO_CACHE a FROM t1);
--error ER_BAD_FIELD_ERROR
SELECT * FROM t1 WHERE a IN
(SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
--error ER_WRONG_USAGE
SELECT SQL_CACHE SQL_NO_CACHE * FROM t1;
--error ER_WRONG_USAGE
SELECT SQL_NO_CACHE SQL_CACHE * FROM t1;
--error ER_CANT_USE_OPTION_HERE
SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
--error ER_CANT_USE_OPTION_HERE
SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
--error ER_CANT_USE_OPTION_HERE
SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
--error ER_CANT_USE_OPTION_HERE
SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
--error ER_BAD_FIELD_ERROR
SELECT SQL_CACHE * FROM t1 WHERE a IN
(SELECT SQL_NO_CACHE a FROM t1);
--error ER_BAD_FIELD_ERROR
SELECT SQL_CACHE * FROM t1 WHERE a IN
(SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
DROP TABLE t1;
--echo End of 5.1 tests

View file

@ -3791,6 +3791,56 @@ SELECT 1 FROM t2 JOIN t1 ON 1=1
DROP TABLE t1,t2;
--echo #
--echo # Bug #49199: Optimizer handles incorrectly:
--echo # field='const1' AND field='const2' in some cases
--echo
CREATE TABLE t1(a DATETIME NOT NULL);
INSERT INTO t1 VALUES('2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
DROP TABLE t1;
CREATE TABLE t1(a DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
DROP TABLE t1;
CREATE TABLE t1(a TIMESTAMP NOT NULL);
INSERT INTO t1 VALUES('2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
DROP TABLE t1;
CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
DROP TABLE t1;
CREATE TABLE t1(a DATETIME NOT NULL, b VARCHAR(20) NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01';
DROP TABLE t1;
CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
SELECT x.a, y.a, z.a FROM t1 x
JOIN t1 y ON x.a=y.a
JOIN t1 z ON y.a=z.a
WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00';
EXPLAIN EXTENDED SELECT x.a, y.a, z.a FROM t1 x
JOIN t1 y ON x.a=y.a
JOIN t1 z ON y.a=z.a
WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00';
DROP TABLE t1;
--echo End of 5.0 tests
#
@ -4002,4 +4052,27 @@ ORDER BY pk;
DROP TABLE t1;
--echo #
--echo # Bug#49489 Uninitialized cache led to a wrong result.
--echo #
CREATE TABLE t1(c1 DOUBLE(5,4));
INSERT INTO t1 VALUES (9.1234);
SELECT * FROM t1 WHERE c1 < 9.12345;
DROP TABLE t1;
--echo # End of test for bug#49489.
--echo #
--echo # Bug #49517: Inconsistent behavior while using
--echo # NULLable BIGINT and INT columns in comparison
--echo #
CREATE TABLE t1(a BIGINT UNSIGNED NOT NULL, b BIGINT NULL, c INT NULL);
INSERT INTO t1 VALUES(105, NULL, NULL);
SELECT * FROM t1 WHERE b < 102;
SELECT * FROM t1 WHERE c < 102;
SELECT * FROM t1 WHERE 102 < b;
SELECT * FROM t1 WHERE 102 < c;
DROP TABLE t1;
--echo End of 5.1 tests

View file

@ -550,18 +550,14 @@ CREATE VIEW v1 AS SELECT SQL_NO_CACHE NOW();
SHOW CREATE VIEW v1;
DROP VIEW v1;
# Check that SQL_NO_CACHE always wins.
--error ER_WRONG_USAGE
CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW();
SHOW CREATE VIEW v1;
DROP VIEW v1;
--error ER_WRONG_USAGE
CREATE VIEW v1 AS SELECT SQL_NO_CACHE SQL_CACHE NOW();
SHOW CREATE VIEW v1;
DROP VIEW v1;
--error ER_WRONG_USAGE
CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE SQL_CACHE NOW();
SHOW CREATE VIEW v1;
DROP VIEW v1;
# Check CREATE VIEW in a prepared statement in a procedure.
delimiter |;
@ -1192,6 +1188,28 @@ connection default;
DROP USER test_u@localhost;
--echo #
--echo # Bug #48985: show create table crashes if previous access to the table
--echo # was killed
--echo #
connect(con1,localhost,root,,);
CONNECTION con1;
LET $ID= `SELECT connection_id()`;
CONNECTION default;
--disable_query_log
eval KILL QUERY $ID;
--enable_query_log
CONNECTION con1;
--error ER_QUERY_INTERRUPTED
SHOW CREATE TABLE non_existent;
CONNECTION default;
DISCONNECT con1;
--echo End of 5.1 tests
# Wait till all disconnects are completed

View file

@ -146,3 +146,32 @@ END|
delimiter ;|
#
# Bug#48766 SHOW CREATE FUNCTION returns extra data in return clause
#
SET NAMES utf8;
--disable_warnings
DROP FUNCTION IF EXISTS bug48766;
--enable_warnings
#
# Test that Latin letters are not prepended with extra '\0'.
#
CREATE FUNCTION bug48766 ()
RETURNS ENUM( 'w' ) CHARACTER SET ucs2
RETURN 0;
SHOW CREATE FUNCTION bug48766;
SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME='bug48766';
DROP FUNCTION bug48766;
#
# Test non-Latin characters
#
CREATE FUNCTION bug48766 ()
RETURNS ENUM('а','б','в','г') CHARACTER SET ucs2
RETURN 0;
SHOW CREATE FUNCTION bug48766;
SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME='bug48766';
DROP FUNCTION bug48766;

Some files were not shown because too many files have changed in this diff Show more