mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merging with 5.1-5.1.29-rc.
This commit is contained in:
7
BUILD/compile-solaris-amd64-forte
Normal file → Executable file
7
BUILD/compile-solaris-amd64-forte
Normal file → Executable file
@ -7,22 +7,23 @@ path=`dirname $0`
|
||||
. "$path/autorun.sh"
|
||||
|
||||
# For "optimal" code for this computer add -fast to EXTRA
|
||||
# To compile 64 bit, add -xarch=v9 to EXTRA_64_BIT
|
||||
# To compile 64 bit, add -m64 to EXTRA_64_BIT
|
||||
|
||||
EXTRA_64_BIT="-xarch=amd64"
|
||||
EXTRA_64_BIT="-m64"
|
||||
EXTRA="-fast"
|
||||
|
||||
#
|
||||
# The following should not need to be touched
|
||||
#
|
||||
|
||||
export CC CXX CFLAGS CXXFLAGS
|
||||
export CC CXX CFLAGS CXXFLAGS LIBS
|
||||
STD="-g -mt -D_FORTEC_ $EXTRA $EXTRA_64_BIT"
|
||||
ASFLAGS="$EXTRA_64_BIT"
|
||||
CC=cc-5.0
|
||||
CFLAGS="-Xa -xstrconst $STD"
|
||||
CXX=CC
|
||||
CXXFLAGS="-noex $STD"
|
||||
LIBS=-lmtmalloc
|
||||
./configure \
|
||||
--prefix=/usr/local/mysql \
|
||||
--localstatedir=/usr/local/mysql/data \
|
||||
|
@ -6,8 +6,8 @@ gmake -k clean || true
|
||||
path=`dirname $0`
|
||||
. "$path/autorun.sh"
|
||||
|
||||
# To compile 64 bit, add -xarch=amd64 to EXTRA_64_BIT
|
||||
EXTRA_64_BIT="-xarch=amd64"
|
||||
# To compile 64 bit, add -m64 to EXTRA_64_BIT
|
||||
EXTRA_64_BIT="-m64"
|
||||
|
||||
# For "optimal" code for this computer add -fast to EXTRA. Note that
|
||||
# this causes problem with debugging the program since -fast implies
|
||||
|
@ -9,6 +9,6 @@ PATH=$PATH:/usr/ccs/bin:/usr/local/bin
|
||||
path=`dirname $0`
|
||||
. "$path/autorun.sh"
|
||||
|
||||
CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa" CXX=gcc CXXFLAGS="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa -g" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client
|
||||
CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa" CXX=gcc CXXFLAGS="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa -g" LIBS="-lmtmalloc" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client
|
||||
|
||||
make -j 4
|
||||
|
@ -29,7 +29,7 @@ EXTRA="-fast" # Remove comment to target current machine
|
||||
|
||||
STD="-mt -D_FORTEC_ $EXTRA $EXTRA_64_BIT"
|
||||
CC=cc-5.0 CFLAGS="-Xa -xstrconst $STD" \
|
||||
CXX=CC CXXFLAGS="-noex $STD" \
|
||||
CXX=CC CXXFLAGS="-noex $STD" LIBS="-lmtmalloc" \
|
||||
./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --prefix=$PREFIX
|
||||
|
||||
make -j 4
|
||||
|
@ -108,18 +108,18 @@ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805")
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
|
||||
# Disable warnings in Visual Studio 8 and above
|
||||
IF(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /wd4996")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4996")
|
||||
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4996")
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /wd4996")
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
|
||||
CMAKE_GENERATOR MATCHES "Visual Studio 8")
|
||||
ENDIF(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
|
||||
# Settings for Visual Studio 7 and above.
|
||||
IF(MSVC)
|
||||
# replace /MDd with /MTd
|
||||
STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
|
||||
STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})
|
||||
@ -149,9 +149,7 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
|
||||
IF(NOT tmp_manifest)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
|
||||
ENDIF(NOT tmp_manifest)
|
||||
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
|
||||
CMAKE_GENERATOR MATCHES "Visual Studio 8")
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF(WIN32)
|
||||
ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE")
|
||||
|
@ -2396,8 +2396,15 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
fprintf(sql_file, ",\n %s %s",
|
||||
quote_name(row[0], name_buff, 0), row[1]);
|
||||
}
|
||||
|
||||
/*
|
||||
Stand-in tables are always MyISAM tables as the default
|
||||
engine might have a column-limit that's lower than the
|
||||
number of columns in the view, and MyISAM support is
|
||||
guaranteed to be in the server anyway.
|
||||
*/
|
||||
fprintf(sql_file,
|
||||
"\n) */;\n"
|
||||
"\n) ENGINE=MyISAM */;\n"
|
||||
"SET character_set_client = @saved_cs_client;\n");
|
||||
|
||||
check_io(sql_file);
|
||||
|
@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
|
||||
#
|
||||
# When changing major version number please also check switch statement
|
||||
# in mysqlbinlog::check_master_version().
|
||||
AM_INIT_AUTOMAKE(mysql, 5.1.29)
|
||||
AM_INIT_AUTOMAKE(mysql, 5.1.30)
|
||||
AM_CONFIG_HEADER([include/config.h:config.h.in])
|
||||
|
||||
PROTOCOL_VERSION=10
|
||||
@ -2714,6 +2714,9 @@ then
|
||||
sql_server="vio sql"
|
||||
fi
|
||||
|
||||
# "innochecksum" is not in the "innobase/" subdirectory, but should be switched
|
||||
AM_CONDITIONAL([BUILD_INNODB_TOOLS], [test X"$with_plugin_innobase" = Xyes])
|
||||
|
||||
# IMPORTANT - do not modify LIBS past this line - this hack is the only way
|
||||
# I know to add the static NSS magic if we have static NSS libraries with
|
||||
# glibc - Sasha
|
||||
|
@ -43,7 +43,12 @@ $(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h
|
||||
$(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h
|
||||
|
||||
bin_PROGRAMS = replace perror resolveip my_print_defaults \
|
||||
resolve_stack_dump mysql_waitpid innochecksum
|
||||
resolve_stack_dump mysql_waitpid
|
||||
# "innochecksum" should be switched
|
||||
if BUILD_INNODB_TOOLS
|
||||
bin_PROGRAMS += innochecksum
|
||||
endif
|
||||
|
||||
noinst_PROGRAMS = charset2html
|
||||
EXTRA_PROGRAMS = comp_err
|
||||
EXTRA_DIST = CMakeLists.txt
|
||||
|
@ -1,6 +1,5 @@
|
||||
SUBDIRS = taocrypt src testsuite
|
||||
EXTRA_DIST = yassl.dsp yassl.dsw yassl.vcproj \
|
||||
CMakeLists.txt
|
||||
EXTRA_DIST = CMakeLists.txt
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
@ -1,5 +1,5 @@
|
||||
SUBDIRS = src test benchmark
|
||||
EXTRA_DIST = taocrypt.dsw taocrypt.dsp taocrypt.vcproj CMakeLists.txt $(wildcard mySTL/*.hpp)
|
||||
EXTRA_DIST = CMakeLists.txt $(wildcard mySTL/*.hpp)
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
@ -1,268 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="taocrypt"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\debug_obj"
|
||||
IntermediateDirectory=".\debug_obj"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories="include,mySTL"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
ExceptionHandling="FALSE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\debug_obj/taocrypt.pch"
|
||||
AssemblerListingLocation=".\debug_obj/"
|
||||
ObjectFile=".\debug_obj/"
|
||||
ProgramDataBaseFileName=".\debug_obj/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile=".\debug_obj\taocrypt.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\release_obj"
|
||||
IntermediateDirectory=".\release_obj"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories="include,mySTL"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
StringPooling="TRUE"
|
||||
ExceptionHandling="FALSE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\release_obj/taocrypt.pch"
|
||||
AssemblerListingLocation=".\release_obj/"
|
||||
ObjectFile=".\release_obj/"
|
||||
ProgramDataBaseFileName=".\release_obj/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile=".\release_obj\taocrypt.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="src\aes.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\aestables.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\algebra.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\arc4.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\asn.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\coding.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\des.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\dh.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\dsa.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\file.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\hash.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\integer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\md2.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\md4.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\md5.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\misc.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\random.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\ripemd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\rsa.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\sha.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="include\aes.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\algebra.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\arc4.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\asn.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\block.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\coding.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\des.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\dh.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\dsa.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\error.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\file.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\hash.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\hmac.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\integer.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\md2.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\md4.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\md5.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\misc.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\modarith.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\modes.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\random.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\ripemd.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\rsa.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\sha.hpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,211 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="yassl"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\debug_obj"
|
||||
IntermediateDirectory=".\debug_obj"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories="include,taocrypt\include,taocrypt\mySTL"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;YASSL_PREFIX"
|
||||
ExceptionHandling="FALSE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\debug_obj/yassl.pch"
|
||||
AssemblerListingLocation=".\debug_obj/"
|
||||
ObjectFile=".\debug_obj/"
|
||||
ProgramDataBaseFileName=".\debug_obj/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile=".\debug_obj\yassl.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\release_obj"
|
||||
IntermediateDirectory=".\release_obj"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories="include,taocrypt\include,taocrypt\mySTL"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;YASSL_PREFIX"
|
||||
StringPooling="TRUE"
|
||||
ExceptionHandling="FALSE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\release_obj/yassl.pch"
|
||||
AssemblerListingLocation=".\release_obj/"
|
||||
ObjectFile=".\release_obj/"
|
||||
ProgramDataBaseFileName=".\release_obj/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile=".\release_obj\yassl.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="src\buffer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\cert_wrapper.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\crypto_wrapper.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\handshake.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\lock.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\log.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\socket_wrapper.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\ssl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\timer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\yassl_error.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\yassl_imp.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\yassl_int.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="include\buffer.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\cert_wrapper.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\crypto_wrapper.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\factory.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\handshake.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\lock.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\log.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\socket_wrapper.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\timer.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\yassl_error.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\yassl_imp.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\yassl_int.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="include\yassl_types.hpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -29,6 +29,14 @@ extern ulong locks_immediate,locks_waited ;
|
||||
|
||||
enum thr_lock_type { TL_IGNORE=-1,
|
||||
TL_UNLOCK, /* UNLOCK ANY LOCK */
|
||||
/*
|
||||
Parser only! At open_tables() becomes TL_READ or
|
||||
TL_READ_NO_INSERT depending on the binary log format
|
||||
(SBR/RBR) and on the table category (log table).
|
||||
Used for tables that are read by statements which
|
||||
modify tables.
|
||||
*/
|
||||
TL_READ_DEFAULT,
|
||||
TL_READ, /* Read lock */
|
||||
TL_READ_WITH_SHARED_LOCKS,
|
||||
/* High prior. than TL_WRITE. Allow concurrent insert */
|
||||
|
@ -89,9 +89,20 @@ BOOL APIENTRY LibMain(HANDLE hInst,DWORD ul_reason_being_called,
|
||||
UNREFERENCED_PARAMETER(lpReserved);
|
||||
} /* LibMain */
|
||||
|
||||
|
||||
static BOOL do_libmain;
|
||||
int __stdcall DllMain(HANDLE hInst,DWORD ul_reason_being_called,LPVOID lpReserved)
|
||||
{
|
||||
/*
|
||||
Unless environment variable LIBMYSQL_DLLINIT is set, do nothing.
|
||||
The environment variable is checked once, during the first call to DllMain()
|
||||
(in DLL_PROCESS_ATTACH hook).
|
||||
*/
|
||||
if (ul_reason_being_called == DLL_PROCESS_ATTACH)
|
||||
do_libmain = (getenv("LIBMYSQL_DLLINIT") != NULL);
|
||||
if (do_libmain)
|
||||
return LibMain(hInst,ul_reason_being_called,lpReserved);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#elif defined(WINDOWS)
|
||||
|
@ -21,5 +21,9 @@ man1_MANS = @man1_files@
|
||||
man8_MANS = @man8_files@
|
||||
EXTRA_DIST = $(man1_MANS) $(man8_MANS)
|
||||
|
||||
# "make_win_*" are not needed in Unix binary packages,
|
||||
install-data-hook:
|
||||
rm -f $(DESTDIR)$(manlibdir)/man1/make_win_*
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
@ -125,6 +125,45 @@ drop table t1;
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
|
||||
show binlog events from 0;
|
||||
|
||||
|
||||
#
|
||||
# Bug #39182: Binary log producing incompatible character set query from
|
||||
# stored procedure.
|
||||
#
|
||||
reset master;
|
||||
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
|
||||
USE bug39182;
|
||||
CREATE TABLE t1 (a VARCHAR(255) COLLATE utf8_unicode_ci)
|
||||
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
DELIMITER //;
|
||||
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE s1 VARCHAR(255);
|
||||
SET s1= "test";
|
||||
CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", s1, "%");
|
||||
SELECT
|
||||
COLLATION(NAME_CONST('s1', _utf8'test')) c1,
|
||||
COLLATION(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) c2,
|
||||
COLLATION(s1) c3,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test')) d1,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
|
||||
COERCIBILITY(s1) d3;
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
END//
|
||||
|
||||
DELIMITER ;//
|
||||
|
||||
CALL p1();
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug39182;
|
||||
USE test;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Test of a too big SET INSERT_ID: see if the truncated value goes
|
||||
|
@ -7,6 +7,7 @@
|
||||
# Actually this test has nothing to do with innodb per se, it just requires
|
||||
# transactional table.
|
||||
#
|
||||
flush status;
|
||||
show status like "binlog_cache_use";
|
||||
show status like "binlog_cache_disk_use";
|
||||
--disable_warnings
|
||||
@ -38,12 +39,3 @@ commit;
|
||||
show status like "binlog_cache_use";
|
||||
show status like "binlog_cache_disk_use";
|
||||
drop table t1;
|
||||
|
||||
# Test for testable InnoDB status variables. This test
|
||||
# uses previous ones(pages_created, rows_deleted, ...).
|
||||
show status like "Innodb_buffer_pool_pages_total";
|
||||
show status like "Innodb_page_size";
|
||||
show status like "Innodb_rows_deleted";
|
||||
show status like "Innodb_rows_inserted";
|
||||
show status like "Innodb_rows_updated";
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
eval create table t1 (a int) engine=$engine_type;
|
||||
flush tables;
|
||||
system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
|
||||
remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
|
||||
drop table if exists t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
|
@ -151,6 +151,20 @@ DROP DATABASE IF EXISTS mysqltest3;
|
||||
CREATE DATABASE mysqltest1;
|
||||
CREATE DATABASE mysqltest2;
|
||||
eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
|
||||
# Prevent Bug#26687 rpl_ddl test fails if run with --innodb option
|
||||
# The testscript (suite/rpl/rpl_ddl.test) + the expected result need that the
|
||||
# slave uses MyISAM for the table mysqltest.t1.
|
||||
# This is not valid in case of suite/rpl_ndb/rpl_ndb_ddl.test which sources
|
||||
# also this script.
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
if (`SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_SCHEMA = 'mysqltest1' AND TABLE_NAME = 't1'
|
||||
AND ENGINE <> 'MyISAM' AND '$engine_type' <> 'NDB'`)
|
||||
{
|
||||
skip This test needs on slave side: InnoDB disabled, default engine: MyISAM;
|
||||
}
|
||||
connection master;
|
||||
INSERT INTO mysqltest1.t1 SET f1= 0;
|
||||
eval CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=$engine_type;
|
||||
|
@ -13,22 +13,15 @@ save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
stop slave;
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
reset master;
|
||||
reset slave;
|
||||
# We are going to read the slave's binlog which contains file_id (for some LOAD
|
||||
# DATA INFILE); to make it repeatable (not influenced by other tests), we need
|
||||
# to stop and start the slave, to be sure file_id will start from 1.
|
||||
# This can be done with 'server_stop slave', but
|
||||
# this would require the manager, so most of the time the test will be skipped
|
||||
# :(
|
||||
# To workaround this, I (Guilhem) add a (empty) rpl_log-slave.opt (because when
|
||||
# mysql-test-run finds such a file it restarts the slave before doing the
|
||||
# test). That's not very elegant but I could find no better way, sorry.
|
||||
start slave;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
|
||||
let $VERSION=`select version()`;
|
||||
|
||||
connection master;
|
||||
reset master;
|
||||
eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_type;
|
||||
insert into t1 values (NULL);
|
||||
drop table t1;
|
||||
@ -79,7 +72,6 @@ connection slave;
|
||||
# Note that the above 'slave start' will cause a 3rd rotate event (a fake one)
|
||||
# to go into the relay log (the master always sends a fake one when replication
|
||||
# starts).
|
||||
start slave;
|
||||
let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%';
|
||||
--source include/wait_slave_status.inc
|
||||
sync_with_master;
|
||||
@ -87,6 +79,7 @@ sync_with_master;
|
||||
select * from t1 order by 1 asc;
|
||||
flush logs;
|
||||
stop slave;
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
connection master;
|
||||
|
||||
# Create some entries for second log
|
||||
@ -95,6 +88,7 @@ eval create table t2 (n int)ENGINE=$engine_type;
|
||||
insert into t2 values (1);
|
||||
source include/show_binlog_events.inc;
|
||||
--replace_result $VERSION VERSION
|
||||
--replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /infile '.+'/infile 'words.dat'/
|
||||
--replace_column 2 # 5 #
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||
show binlog events in 'master-bin.000002';
|
||||
@ -102,10 +96,12 @@ show binary logs;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
start slave;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
sync_with_master;
|
||||
show binary logs;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
|
||||
--replace_column 2 # 5 #
|
||||
--replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /INFILE '.+'/INFILE 'words.dat'/
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||
show binlog events in 'slave-bin.000001' from 4;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
|
||||
|
@ -1,6 +1,7 @@
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 1 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter > $MYSQLTEST_VARDIR/tmp/tmp.dat
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 2 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter >> $MYSQLTEST_VARDIR/tmp/tmp.dat
|
||||
--exec sort $MYSQLTEST_VARDIR/tmp/tmp.dat
|
||||
--exec rm -f $MYSQLTEST_VARDIR/tmp/tmp.dat
|
||||
--error 0,1
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/tmp.dat
|
||||
--let ndb_restore_opts=
|
||||
--let ndb_restore_filter=
|
||||
|
@ -17,6 +17,9 @@ if ($show_sql_error)
|
||||
echo Last_SQL_Error = $error;
|
||||
}
|
||||
|
||||
# wait for SQL thread to stop after the error
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
|
||||
# skip the erroneous statement
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
|
@ -433,41 +433,51 @@ sub optimize_cases {
|
||||
# Skip processing if already marked as skipped
|
||||
next if $tinfo->{skip};
|
||||
|
||||
# Replication test needs an adjustment of binlog format
|
||||
if (mtr_match_prefix($tinfo->{'name'}, "rpl"))
|
||||
{
|
||||
|
||||
# =======================================================
|
||||
# Get binlog-format used by this test from master_opt
|
||||
# =======================================================
|
||||
my $test_binlog_format;
|
||||
foreach my $opt ( @{$tinfo->{master_opt}} ) {
|
||||
$test_binlog_format= $test_binlog_format ||
|
||||
mtr_match_prefix($opt, "--binlog-format=");
|
||||
}
|
||||
# print $tinfo->{name}." uses ".$test_binlog_format."\n";
|
||||
|
||||
# =======================================================
|
||||
# If a special binlog format was selected with
|
||||
# --mysqld=--binlog-format=x, skip all test with different
|
||||
# binlog-format
|
||||
# --mysqld=--binlog-format=x, skip all test that does not
|
||||
# support it
|
||||
# =======================================================
|
||||
if (defined $::used_binlog_format and
|
||||
$test_binlog_format and
|
||||
$::used_binlog_format ne $test_binlog_format)
|
||||
#print "used_binlog_format: $::used_binlog_format\n";
|
||||
if (defined $::used_binlog_format )
|
||||
{
|
||||
# =======================================================
|
||||
# Fixed --binlog-format=x specified on command line
|
||||
# =======================================================
|
||||
if ( defined $tinfo->{'binlog_formats'} )
|
||||
{
|
||||
#print "binlog_formats: ". join(", ", @{$tinfo->{binlog_formats}})."\n";
|
||||
|
||||
# The test supports different binlog formats
|
||||
# check if the selected one is ok
|
||||
my $supported=
|
||||
grep { $_ eq $::used_binlog_format } @{$tinfo->{'binlog_formats'}};
|
||||
if ( !$supported )
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
$tinfo->{'comment'}= "Requires --binlog-format='$test_binlog_format'";
|
||||
next;
|
||||
$tinfo->{'comment'}=
|
||||
"Doesn't support --binlog-format='$::used_binlog_format'";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# =======================================================
|
||||
# Use dynamic switching of binlog format
|
||||
# =======================================================
|
||||
|
||||
# Get binlog-format used by this test from master_opt
|
||||
my $test_binlog_format;
|
||||
foreach my $opt ( @{$tinfo->{master_opt}} ) {
|
||||
$test_binlog_format=
|
||||
mtr_match_prefix($opt, "--binlog-format=") || $test_binlog_format;
|
||||
}
|
||||
|
||||
# =======================================================
|
||||
# Check that testcase supports the designated binlog-format
|
||||
# =======================================================
|
||||
if ($test_binlog_format and defined $tinfo->{'sup_binlog_formats'} )
|
||||
if (defined $test_binlog_format and
|
||||
defined $tinfo->{binlog_formats} )
|
||||
{
|
||||
my $supported=
|
||||
grep { $_ eq $test_binlog_format } @{$tinfo->{'sup_binlog_formats'}};
|
||||
grep { $_ eq $test_binlog_format } @{$tinfo->{'binlog_formats'}};
|
||||
if ( !$supported )
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
@ -476,20 +486,8 @@ sub optimize_cases {
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
# =======================================================
|
||||
# Use dynamic switching of binlog-format if mtr started
|
||||
# w/o --mysqld=--binlog-format=xxx and combinations.
|
||||
# =======================================================
|
||||
if (!defined $tinfo->{'combination'} and
|
||||
!defined $::used_binlog_format)
|
||||
{
|
||||
$test_binlog_format= $tinfo->{'sup_binlog_formats'}->[0];
|
||||
}
|
||||
|
||||
# Save binlog format for dynamic switching
|
||||
$tinfo->{binlog_format}= $test_binlog_format;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -879,18 +877,19 @@ sub collect_one_test_case($$$$$$$$$) {
|
||||
# the specified value in "tinfo"
|
||||
our @tags=
|
||||
(
|
||||
["include/have_innodb.inc", "innodb_test", 1],
|
||||
["include/have_binlog_format_row.inc", "sup_binlog_formats", ["row"]],
|
||||
["include/have_log_bin.inc", "need_binlog", 1],
|
||||
["include/have_binlog_format_statement.inc",
|
||||
"sup_binlog_formats", ["statement"]],
|
||||
["include/have_binlog_format_mixed.inc", "sup_binlog_formats", ["mixed"]],
|
||||
|
||||
["include/have_binlog_format_row.inc", "binlog_formats", ["row"]],
|
||||
["include/have_binlog_format_statement.inc", "binlog_formats", ["statement"]],
|
||||
["include/have_binlog_format_mixed.inc", "binlog_formats", ["mixed"]],
|
||||
["include/have_binlog_format_mixed_or_row.inc",
|
||||
"sup_binlog_formats", ["mixed","row"]],
|
||||
"binlog_formats", ["mixed", "row"]],
|
||||
["include/have_binlog_format_mixed_or_statement.inc",
|
||||
"sup_binlog_formats", ["mixed","statement"]],
|
||||
"binlog_formats", ["mixed", "statement"]],
|
||||
["include/have_binlog_format_row_or_statement.inc",
|
||||
"sup_binlog_formats", ["row","statement"]],
|
||||
"binlog_formats", ["row", "statement"]],
|
||||
|
||||
["include/have_innodb.inc", "innodb_test", 1],
|
||||
["include/have_log_bin.inc", "need_binlog", 1],
|
||||
["include/big_test.inc", "big_test", 1],
|
||||
["include/have_debug.inc", "need_debug", 1],
|
||||
["include/have_ndb.inc", "ndb_test", 1],
|
||||
|
@ -312,7 +312,7 @@ sub mtr_report_stats ($) {
|
||||
/Slave: According to the master's version/ or
|
||||
/Slave: Column [0-9]* type mismatch/ or
|
||||
/Slave: Error .* doesn't exist/ or
|
||||
/Slave: Error .*Deadlock found/ or
|
||||
/Slave: Deadlock found/ or
|
||||
/Slave: Error .*Unknown table/ or
|
||||
/Slave: Error in Write_rows event: / or
|
||||
/Slave: Field .* of table .* has no default value/ or
|
||||
|
@ -4356,21 +4356,12 @@ sub run_testcase_need_master_restart($)
|
||||
# as the current test requires
|
||||
elsif (! mtr_same_opts($master->[0]->{'start_opts'},
|
||||
$tinfo->{'master_opt'}) )
|
||||
{
|
||||
# Chech that diff is binlog format only
|
||||
my $diff_opts= mtr_diff_opts($master->[0]->{'start_opts'},$tinfo->{'master_opt'});
|
||||
if (scalar(@$diff_opts) eq 2)
|
||||
{
|
||||
$do_restart= 1 unless ($diff_opts->[0] =~/^--binlog-format=/ and $diff_opts->[1] =~/^--binlog-format=/);
|
||||
}
|
||||
else
|
||||
{
|
||||
$do_restart= 1;
|
||||
mtr_verbose("Restart master: running with different options '" .
|
||||
join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
|
||||
join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
|
||||
}
|
||||
}
|
||||
elsif( ! $master->[0]->{'pid'} )
|
||||
{
|
||||
if ( $opt_extern )
|
||||
|
@ -454,3 +454,11 @@ select last_insert_id();
|
||||
last_insert_id()
|
||||
3
|
||||
drop table t1;
|
||||
create table t1 (a int primary key auto_increment, b int, c int, e int, d timestamp default current_timestamp, unique(b),unique(c),unique(e));
|
||||
insert into t1 values(null,1,1,1,now());
|
||||
insert into t1 values(null,0,0,0,null);
|
||||
replace into t1 values(null,1,0,2,null);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
3
|
||||
drop table t1;
|
||||
|
@ -90,4 +90,9 @@ Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) AS `COUNT(*)` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a TIMESTAMP);
|
||||
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
|
||||
SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
|
||||
a
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@ -40,9 +40,9 @@ IN ind DECIMAL(10,2))
|
||||
BEGIN
|
||||
INSERT INTO t4 VALUES (ins1, ins2, ind);
|
||||
END
|
||||
master-bin.000001 784 Query 1 992 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
|
||||
master-bin.000001 992 Query 1 1081 use `test`; DROP PROCEDURE bug18293
|
||||
master-bin.000001 1081 Query 1 1160 use `test`; DROP TABLE t4
|
||||
master-bin.000001 784 Query 1 1048 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
|
||||
master-bin.000001 1048 Query 1 1137 use `test`; DROP PROCEDURE bug18293
|
||||
master-bin.000001 1137 Query 1 1216 use `test`; DROP TABLE t4
|
||||
End of 5.0 tests
|
||||
SHOW BINLOG EVENTS FROM 364;
|
||||
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
|
||||
|
@ -1098,6 +1098,17 @@ ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_gen
|
||||
select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0);
|
||||
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '='
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET UCS2);
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
SET @@sql_mode=pad_char_to_full_length;
|
||||
SELECT HEX(s1) FROM t1;
|
||||
HEX(s1)
|
||||
00610020002000200020
|
||||
SET @@sql_mode=default;
|
||||
SELECT HEX(s1) FROM t1;
|
||||
HEX(s1)
|
||||
0061
|
||||
DROP TABLE t1;
|
||||
set collation_connection=ucs2_general_ci;
|
||||
drop table if exists t1;
|
||||
create table t1 as
|
||||
|
@ -608,6 +608,65 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
|
||||
a a
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20)
|
||||
default NULL);
|
||||
INSERT INTO t1 VALUES (1,1,'ORANGE');
|
||||
INSERT INTO t1 VALUES (2,2,'APPLE');
|
||||
INSERT INTO t1 VALUES (3,2,'APPLE');
|
||||
INSERT INTO t1 VALUES (4,3,'PEAR');
|
||||
SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name =
|
||||
'APPLE';
|
||||
SELECT @v1, @v2;
|
||||
@v1 @v2
|
||||
2 APPLE
|
||||
SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id,
|
||||
fruit_name HAVING fruit_name = 'APPLE';
|
||||
SELECT @v3, @v4;
|
||||
@v3 @v4
|
||||
2 APPLE
|
||||
SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
|
||||
fruit_name = 'APPLE';
|
||||
SELECT @v5, @v6, @v7, @v8;
|
||||
@v5 @v6 @v7 @v8
|
||||
3 PEAR 3 PEAR
|
||||
SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
|
||||
WHERE fruit_name = 'APPLE';
|
||||
SELECT @v5, @v6, @v7, @v8, @v9, @v10;
|
||||
@v5 @v6 @v7 @v8 @v9 @v10
|
||||
3 PEAR 3 PEAR 5 PEARAPPLE
|
||||
SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
|
||||
@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
|
||||
SELECT @v11, @v12, @v13, @v14;
|
||||
@v11 @v12 @v13 @v14
|
||||
6 PEARPEAR 6 PEARPEAR
|
||||
SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
|
||||
SELECT @v15, @v16;
|
||||
@v15 @v16
|
||||
6 PEARPEAR
|
||||
SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
|
||||
'APPLE';
|
||||
SELECT @v17, @v18;
|
||||
@v17 @v18
|
||||
4 Bob
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
|
||||
default NULL);
|
||||
SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
|
||||
'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
|
||||
LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
|
||||
SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
|
||||
'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
|
||||
LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
|
||||
SELECT @v19, @v20;
|
||||
@v19 @v20
|
||||
2 APPLE
|
||||
SELECT * FROM t2;
|
||||
fruit_id fruit_name
|
||||
2 APPLE
|
||||
2 APPLE
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
CREATE TABLE t1 (a CHAR(1));
|
||||
INSERT INTO t1 VALUES('A'), (0);
|
||||
SELECT a FROM t1 WHERE a=0;
|
||||
|
@ -328,4 +328,81 @@ create event
|
||||
очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66
|
||||
on schedule every 2 year do select 1;
|
||||
ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
|
||||
create event event_35981 on schedule every 6 month on completion preserve
|
||||
disable
|
||||
do
|
||||
select 1;
|
||||
The following SELECTs should all give 1
|
||||
select count(*) from information_schema.events
|
||||
where event_schema = database() and event_name = 'event_35981' and
|
||||
on_completion = 'PRESERVE';
|
||||
count(*)
|
||||
1
|
||||
alter event event_35981 enable;
|
||||
select count(*) from information_schema.events
|
||||
where event_schema = database() and event_name = 'event_35981' and
|
||||
on_completion = 'PRESERVE';
|
||||
count(*)
|
||||
1
|
||||
alter event event_35981 on completion not preserve;
|
||||
select count(*) from information_schema.events
|
||||
where event_schema = database() and event_name = 'event_35981' and
|
||||
on_completion = 'NOT PRESERVE';
|
||||
count(*)
|
||||
1
|
||||
alter event event_35981 disable;
|
||||
select count(*) from information_schema.events
|
||||
where event_schema = database() and event_name = 'event_35981' and
|
||||
on_completion = 'NOT PRESERVE';
|
||||
count(*)
|
||||
1
|
||||
alter event event_35981 on completion preserve;
|
||||
select count(*) from information_schema.events
|
||||
where event_schema = database() and event_name = 'event_35981' and
|
||||
on_completion = 'PRESERVE';
|
||||
count(*)
|
||||
1
|
||||
drop event event_35981;
|
||||
create event event_35981 on schedule every 6 month disable
|
||||
do
|
||||
select 1;
|
||||
select count(*) from information_schema.events
|
||||
where event_schema = database() and event_name = 'event_35981' and
|
||||
on_completion = 'NOT PRESERVE';
|
||||
count(*)
|
||||
1
|
||||
drop event event_35981;
|
||||
create event event_35981 on schedule every 1 hour starts current_timestamp
|
||||
on completion not preserve
|
||||
do
|
||||
select 1;
|
||||
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
|
||||
ends '1999-01-02 00:00:00';
|
||||
ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.
|
||||
drop event event_35981;
|
||||
create event event_35981 on schedule every 1 hour starts current_timestamp
|
||||
on completion not preserve
|
||||
do
|
||||
select 1;
|
||||
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
|
||||
ends '1999-01-02 00:00:00' on completion preserve;
|
||||
Warnings:
|
||||
Note 1544 Event execution time is in the past. Event has been disabled
|
||||
drop event event_35981;
|
||||
create event event_35981 on schedule every 1 hour starts current_timestamp
|
||||
on completion preserve
|
||||
do
|
||||
select 1;
|
||||
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
|
||||
ends '1999-01-02 00:00:00';
|
||||
Warnings:
|
||||
Note 1544 Event execution time is in the past. Event has been disabled
|
||||
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
|
||||
ends '1999-01-02 00:00:00' on completion not preserve;
|
||||
ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.
|
||||
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
|
||||
ends '1999-01-02 00:00:00' on completion preserve;
|
||||
Warnings:
|
||||
Note 1544 Event execution time is in the past. Event has been disabled
|
||||
drop event event_35981;
|
||||
drop database events_test;
|
||||
|
@ -9,7 +9,9 @@ DROP DATABASE IF EXISTS federated;
|
||||
CREATE DATABASE federated;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
CREATE DATABASE federated;
|
||||
SET @OLD_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @OLD_MASTER_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= 0;
|
||||
SET @OLD_SLAVE_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= 0;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
Warnings:
|
||||
@ -186,6 +188,7 @@ INSERT INTO federated.t1 (name, other) VALUES ('Tenth Name', 101010);
|
||||
SELECT * FROM federated.t1;
|
||||
id name other created
|
||||
1 First Name 11111 2004-04-04 04:04:04
|
||||
10 Tenth Name 101010 2004-04-04 04:04:04
|
||||
2 Second Name 22222 2004-04-04 04:04:04
|
||||
3 Third Name 33333 2004-04-04 04:04:04
|
||||
4 Fourth Name 44444 2004-04-04 04:04:04
|
||||
@ -194,7 +197,6 @@ id name other created
|
||||
7 Seventh Name 77777 2004-04-04 04:04:04
|
||||
8 Eigth Name 88888 2004-04-04 04:04:04
|
||||
9 Ninth Name 99999 2004-04-04 04:04:04
|
||||
10 Tenth Name 101010 2004-04-04 04:04:04
|
||||
SELECT * FROM federated.t1 WHERE id = 5;
|
||||
id name other created
|
||||
5 Fifth Name 55555 2004-04-04 04:04:04
|
||||
@ -208,6 +210,7 @@ SELECT * FROM federated.t1 WHERE name = 'Sixth Name' AND other = 44444;
|
||||
id name other created
|
||||
SELECT * FROM federated.t1 WHERE name like '%th%';
|
||||
id name other created
|
||||
10 Tenth Name 101010 2004-04-04 04:04:04
|
||||
3 Third Name 33333 2004-04-04 04:04:04
|
||||
4 Fourth Name 44444 2004-04-04 04:04:04
|
||||
5 Fifth Name 55555 2004-04-04 04:04:04
|
||||
@ -215,7 +218,6 @@ id name other created
|
||||
7 Seventh Name 77777 2004-04-04 04:04:04
|
||||
8 Eigth Name 88888 2004-04-04 04:04:04
|
||||
9 Ninth Name 99999 2004-04-04 04:04:04
|
||||
10 Tenth Name 101010 2004-04-04 04:04:04
|
||||
UPDATE federated.t1 SET name = '3rd name' WHERE id = 3;
|
||||
SELECT * FROM federated.t1 WHERE name = '3rd name';
|
||||
id name other created
|
||||
@ -336,6 +338,7 @@ VALUES ('Tenth Name', 101010, '2005-03-12 12:00:01');
|
||||
SELECT * FROM federated.t1;
|
||||
id name other created
|
||||
1 First Name 11111 2004-01-01 01:01:01
|
||||
10 Tenth Name 101010 2005-03-12 12:00:01
|
||||
2 Second Name 22222 2004-01-23 02:43:00
|
||||
3 Third Name 33333 2004-02-14 02:14:00
|
||||
4 Fourth Name 44444 2003-04-05 00:00:00
|
||||
@ -344,7 +347,6 @@ id name other created
|
||||
7 Seventh Name 77777 2003-12-12 18:32:00
|
||||
8 Eigth Name 88888 2005-03-12 11:00:00
|
||||
9 Ninth Name 99999 2005-03-12 11:00:01
|
||||
10 Tenth Name 101010 2005-03-12 12:00:01
|
||||
SELECT * FROM federated.t1 WHERE id = 5;
|
||||
id name other created
|
||||
5 Fifth Name 55555 2001-02-02 02:02:02
|
||||
@ -356,6 +358,7 @@ id name other created
|
||||
4 Fourth Name 44444 2003-04-05 00:00:00
|
||||
SELECT * FROM federated.t1 WHERE name like '%th%';
|
||||
id name other created
|
||||
10 Tenth Name 101010 2005-03-12 12:00:01
|
||||
3 Third Name 33333 2004-02-14 02:14:00
|
||||
4 Fourth Name 44444 2003-04-05 00:00:00
|
||||
5 Fifth Name 55555 2001-02-02 02:02:02
|
||||
@ -363,7 +366,6 @@ id name other created
|
||||
7 Seventh Name 77777 2003-12-12 18:32:00
|
||||
8 Eigth Name 88888 2005-03-12 11:00:00
|
||||
9 Ninth Name 99999 2005-03-12 11:00:01
|
||||
10 Tenth Name 101010 2005-03-12 12:00:01
|
||||
UPDATE federated.t1 SET name = '3rd name' WHERE id = 3;
|
||||
SELECT * FROM federated.t1 WHERE name = '3rd name';
|
||||
id name other created
|
||||
@ -470,17 +472,17 @@ id name other
|
||||
7 Seventh Name NULL
|
||||
SELECT * FROM federated.t1 WHERE name IS NULL;
|
||||
id name other
|
||||
4 NULL NULL
|
||||
10 NULL fee fie foe fum
|
||||
4 NULL NULL
|
||||
SELECT * FROM federated.t1 WHERE name IS NULL and other IS NULL;
|
||||
id name other
|
||||
4 NULL NULL
|
||||
SELECT * FROM federated.t1 WHERE name IS NULL or other IS NULL;
|
||||
id name other
|
||||
10 NULL fee fie foe fum
|
||||
2 Second Name NULL
|
||||
4 NULL NULL
|
||||
7 Seventh Name NULL
|
||||
10 NULL fee fie foe fum
|
||||
UPDATE federated.t1
|
||||
SET name = 'Fourth Name', other = 'four four four'
|
||||
WHERE name IS NULL AND other IS NULL;
|
||||
@ -492,6 +494,7 @@ id name other
|
||||
SELECT * FROM federated.t1;
|
||||
id name other
|
||||
1 First Name 11111
|
||||
10 Tenth Name fee fie foe fum
|
||||
2 Second Name two two two two
|
||||
3 Third Name 33333
|
||||
4 Fourth Name four four four
|
||||
@ -500,7 +503,6 @@ id name other
|
||||
7 Seventh Name seven seven
|
||||
8 Eigth Name 88888
|
||||
9 Ninth Name 99999
|
||||
10 Tenth Name fee fie foe fum
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int(20) NOT NULL auto_increment,
|
||||
@ -681,8 +683,8 @@ id col1 col2 col3 col4
|
||||
SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'five 5 five five 5')
|
||||
OR (col2 = 'three Three' AND col3 = 33);
|
||||
id col1 col2 col3 col4
|
||||
5 5 five 5 five five 5 5 55555
|
||||
3 3 three Three 33 33333
|
||||
5 5 five 5 five five 5 5 55555
|
||||
SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'Two two')
|
||||
OR (col2 = 444 AND col3 = 4444444);
|
||||
id col1 col2 col3 col4
|
||||
@ -693,25 +695,25 @@ OR col3 = 33
|
||||
OR col4 = 4444444;
|
||||
id col1 col2 col3 col4
|
||||
1 1 one One 11 1111
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
2 2 Two two 22 2222
|
||||
3 3 three Three 33 33333
|
||||
4 4 fourfourfour 444 4444444
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE id > 5;
|
||||
id col1 col2 col3 col4
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
6 6 six six Sixsix 6666 6
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
8 8 eight eight eight 88888 88
|
||||
9 9 nine Nine 999999 999999
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE id >= 5;
|
||||
id col1 col2 col3 col4
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
5 5 five 5 five five 5 5 55555
|
||||
6 6 six six Sixsix 6666 6
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
8 8 eight eight eight 88888 88
|
||||
9 9 nine Nine 999999 999999
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE id < 5;
|
||||
id col1 col2 col3 col4
|
||||
1 1 one One 11 1111
|
||||
@ -728,6 +730,7 @@ id col1 col2 col3 col4
|
||||
SELECT * FROM federated.t1 WHERE id != 5;
|
||||
id col1 col2 col3 col4
|
||||
1 1 one One 11 1111
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
2 2 Two two 22 2222
|
||||
3 3 three Three 33 33333
|
||||
4 4 fourfourfour 444 4444444
|
||||
@ -735,7 +738,6 @@ id col1 col2 col3 col4
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
8 8 eight eight eight 88888 88
|
||||
9 9 nine Nine 999999 999999
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE id > 3 AND id < 7;
|
||||
id col1 col2 col3 col4
|
||||
4 4 fourfourfour 444 4444444
|
||||
@ -763,25 +765,25 @@ id col1 col2 col3 col4
|
||||
SELECT * FROM federated.t1 WHERE id < 3 OR id > 7;
|
||||
id col1 col2 col3 col4
|
||||
1 1 one One 11 1111
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
2 2 Two two 22 2222
|
||||
8 8 eight eight eight 88888 88
|
||||
9 9 nine Nine 999999 999999
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE col2 = 'three Three';
|
||||
id col1 col2 col3 col4
|
||||
3 3 three Three 33 33333
|
||||
SELECT * FROM federated.t1 WHERE col2 > 'one';
|
||||
id col1 col2 col3 col4
|
||||
1 1 one One 11 1111
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
2 2 Two two 22 2222
|
||||
3 3 three Three 33 33333
|
||||
6 6 six six Sixsix 6666 6
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE col2 LIKE 's%';
|
||||
id col1 col2 col3 col4
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
6 6 six six Sixsix 6666 6
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
SELECT * FROM federated.t1 WHERE col2 LIKE 'si%';
|
||||
id col1 col2 col3 col4
|
||||
6 6 six six Sixsix 6666 6
|
||||
@ -791,6 +793,7 @@ id col1 col2 col3 col4
|
||||
SELECT * FROM federated.t1 WHERE col2 NOT LIKE 'e%';
|
||||
id col1 col2 col3 col4
|
||||
1 1 one One 11 1111
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
2 2 Two two 22 2222
|
||||
3 3 three Three 33 33333
|
||||
4 4 fourfourfour 444 4444444
|
||||
@ -798,18 +801,17 @@ id col1 col2 col3 col4
|
||||
6 6 six six Sixsix 6666 6
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
9 9 nine Nine 999999 999999
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE col2 <> 'one One';
|
||||
id col1 col2 col3 col4
|
||||
4 4 fourfourfour 444 4444444
|
||||
5 5 five 5 five five 5 5 55555
|
||||
8 8 eight eight eight 88888 88
|
||||
9 9 nine Nine 999999 999999
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
2 2 Two two 22 2222
|
||||
3 3 three Three 33 33333
|
||||
4 4 fourfourfour 444 4444444
|
||||
5 5 five 5 five five 5 5 55555
|
||||
6 6 six six Sixsix 6666 6
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
8 8 eight eight eight 88888 88
|
||||
9 9 nine Nine 999999 999999
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
CREATE TABLE federated.t1 (
|
||||
`col1` varchar(8) NOT NULL DEFAULT '',
|
||||
@ -976,11 +978,11 @@ INSERT INTO federated.t1 (name, floatval, other)
|
||||
VALUES (0, 00.3333, NULL);
|
||||
SELECT * FROM federated.t1;
|
||||
id name floatval other
|
||||
NULL NULL NULL NULL
|
||||
NULL NULL NULL NULL
|
||||
1 NULL NULL NULL
|
||||
NULL foo 33.3333 NULL
|
||||
NULL 0 0.3333 NULL
|
||||
NULL NULL NULL NULL
|
||||
NULL NULL NULL NULL
|
||||
NULL foo 33.3333 NULL
|
||||
SELECT count(*) FROM federated.t1
|
||||
WHERE id IS NULL
|
||||
AND name IS NULL
|
||||
@ -2132,6 +2134,8 @@ End of 5.0 tests
|
||||
create server 's1' foreign data wrapper 'mysql' options (port 3306);
|
||||
drop server 's1';
|
||||
End of 5.1 tests
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
|
@ -337,6 +337,126 @@ DROP VIEW v2;
|
||||
DROP VIEW v3;
|
||||
|
||||
# -- End of Bug#35469.
|
||||
Bug#37114
|
||||
SET SESSION character_set_client=latin1;
|
||||
SET SESSION character_set_server=latin1;
|
||||
SET SESSION character_set_connection=latin1;
|
||||
SET @OLD_SQL_MODE=@@SESSION.SQL_MODE;
|
||||
test LOAD DATA INFILE
|
||||
SET sql_mode = '';
|
||||
SELECT '1 \\aa\n' INTO DUMPFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt';
|
||||
CREATE TABLE t1 (id INT, val1 CHAR(3)) ENGINE=MyISAM;
|
||||
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ' ';
|
||||
SELECT * FROM t1;
|
||||
id val1
|
||||
1 \aa
|
||||
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114_out.txt' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1;
|
||||
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114_out.txt' FIELDS TERMINATED BY ' ' FROM t1;
|
||||
INSERT INTO t1 (id, val1) VALUES (1, '\aa');
|
||||
SELECT * FROM t1;
|
||||
id val1
|
||||
1 \aa
|
||||
1 \aa
|
||||
SET sql_mode='';
|
||||
INSERT INTO t1 (id, val1) VALUES (1, '\aa');
|
||||
SELECT * FROM t1;
|
||||
id val1
|
||||
1 \aa
|
||||
1 \aa
|
||||
1 aa
|
||||
DROP TABLE t1;
|
||||
test SELECT INTO OUTFILE
|
||||
CREATE TABLE t1 (id INT PRIMARY KEY, val1 CHAR(4));
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SET sql_mode = '';
|
||||
INSERT INTO t1 (id, val1) VALUES (5, '\ttab');
|
||||
INSERT INTO t1 (id, val1) VALUES (4, '\\r');
|
||||
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
|
||||
INSERT INTO t1 (id, val1) VALUES (3, '\tx');
|
||||
1.1 NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY
|
||||
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id;
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' INTO TABLE t2 FIELDS TERMINATED BY ' ';
|
||||
SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
|
||||
SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
|
||||
t id val1 hex(val1)
|
||||
before 3 \tx 5C7478
|
||||
after 3 \tx 5C7478
|
||||
before 4 \r 5C72
|
||||
after 4 \r 5C72
|
||||
before 5 tab 09746162
|
||||
after 5 tab 09746162
|
||||
TRUNCATE t2;
|
||||
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
|
||||
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
|
||||
3 \tx
|
||||
4 \r
|
||||
5 tab
|
||||
|
||||
1.2 NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY
|
||||
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' FIELDS ESCAPED BY '\' TERMINATED BY ' ' FROM t1 ORDER BY id;
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' INTO TABLE t2 FIELDS ESCAPED BY '\' TERMINATED BY ' ';
|
||||
SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
|
||||
SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
|
||||
t id val1 hex(val1)
|
||||
before 3 \tx 5C7478
|
||||
after 3 \tx 5C7478
|
||||
before 4 \r 5C72
|
||||
after 4 \r 5C72
|
||||
before 5 tab 09746162
|
||||
after 5 tab 09746162
|
||||
TRUNCATE t2;
|
||||
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
|
||||
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
|
||||
3 \\tx
|
||||
4 \\r
|
||||
5 tab
|
||||
|
||||
SET sql_mode = '';
|
||||
2.1 !NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY
|
||||
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id;
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' INTO TABLE t2 FIELDS TERMINATED BY ' ';
|
||||
SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
|
||||
SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
|
||||
t id val1 hex(val1)
|
||||
before 3 \tx 5C7478
|
||||
after 3 \tx 5C7478
|
||||
before 4 \r 5C72
|
||||
after 4 \r 5C72
|
||||
before 5 tab 09746162
|
||||
after 5 tab 09746162
|
||||
TRUNCATE t2;
|
||||
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
|
||||
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
|
||||
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
|
||||
3 \\tx
|
||||
4 \\r
|
||||
5 tab
|
||||
|
||||
SET sql_mode = '';
|
||||
2.2 !NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY
|
||||
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 ORDER BY id;
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' INTO TABLE t2 FIELDS ESCAPED BY '' TERMINATED BY ' ';
|
||||
SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
|
||||
SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
|
||||
t id val1 hex(val1)
|
||||
before 3 \tx 5C7478
|
||||
after 3 \tx 5C7478
|
||||
before 4 \r 5C72
|
||||
after 4 \r 5C72
|
||||
before 5 tab 09746162
|
||||
after 5 tab 09746162
|
||||
TRUNCATE t2;
|
||||
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
|
||||
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
|
||||
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
|
||||
3 \tx
|
||||
4 \r
|
||||
5 tab
|
||||
|
||||
set session sql_mode=@OLD_SQL_MODE;
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
SET NAMES latin1;
|
||||
@ -364,3 +484,4 @@ SET character_set_filesystem=default;
|
||||
select @@character_set_filesystem;
|
||||
@@character_set_filesystem
|
||||
binary
|
||||
End of 5.1 tests
|
||||
|
@ -832,6 +832,35 @@ Execute select '000 001 002 003 004 005 006 007 008 009010 011 012 013 014 015 0
|
||||
Query set global general_log = off
|
||||
deallocate prepare long_query;
|
||||
set global general_log = @old_general_log_state;
|
||||
DROP TABLE IF EXISTS log_count;
|
||||
DROP TABLE IF EXISTS slow_log_copy;
|
||||
DROP TABLE IF EXISTS general_log_copy;
|
||||
CREATE TABLE log_count (count BIGINT(21));
|
||||
SET @old_general_log_state = @@global.general_log;
|
||||
SET @old_slow_log_state = @@global.slow_query_log;
|
||||
SET GLOBAL general_log = ON;
|
||||
SET GLOBAL slow_query_log = ON;
|
||||
CREATE TABLE slow_log_copy SELECT * FROM mysql.slow_log;
|
||||
INSERT INTO slow_log_copy SELECT * FROM mysql.slow_log;
|
||||
INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.slow_log));
|
||||
DROP TABLE slow_log_copy;
|
||||
CREATE TABLE general_log_copy SELECT * FROM mysql.general_log;
|
||||
INSERT INTO general_log_copy SELECT * FROM mysql.general_log;
|
||||
INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log));
|
||||
DROP TABLE general_log_copy;
|
||||
SET GLOBAL general_log = OFF;
|
||||
SET GLOBAL slow_query_log = OFF;
|
||||
CREATE TABLE slow_log_copy SELECT * FROM mysql.slow_log;
|
||||
INSERT INTO slow_log_copy SELECT * FROM mysql.slow_log;
|
||||
INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.slow_log));
|
||||
DROP TABLE slow_log_copy;
|
||||
CREATE TABLE general_log_copy SELECT * FROM mysql.general_log;
|
||||
INSERT INTO general_log_copy SELECT * FROM mysql.general_log;
|
||||
INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log));
|
||||
DROP TABLE general_log_copy;
|
||||
SET GLOBAL general_log = @old_general_log_state;
|
||||
SET GLOBAL slow_query_log = @old_slow_log_state;
|
||||
DROP TABLE log_count;
|
||||
SET @old_slow_log_state = @@global.slow_query_log;
|
||||
SET SESSION long_query_time = 0;
|
||||
SET GLOBAL slow_query_log = ON;
|
||||
|
@ -277,3 +277,16 @@ drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
drop table t6;
|
||||
SELECT @@global.storage_engine INTO @old_engine;
|
||||
SET GLOBAL storage_engine=InnoDB;
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES();
|
||||
SELECT COUNT(*) FROM v1;
|
||||
COUNT(*)
|
||||
1
|
||||
SELECT COUNT(*) FROM v1;
|
||||
COUNT(*)
|
||||
1
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL storage_engine=@old_engine;
|
||||
|
@ -1,3 +1,8 @@
|
||||
Bug#37938 - Test "mysqldump" lacks various insert statements
|
||||
Turn off concurrent inserts to avoid random errors
|
||||
NOTE: We reset the variable back to saved value at the end of test
|
||||
SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT = 0;
|
||||
DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3;
|
||||
drop database if exists mysqldump_test_db;
|
||||
drop database if exists db1;
|
||||
@ -1999,7 +2004,7 @@ SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` varchar(30)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
/*!50001 DROP TABLE `v2`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
@ -2096,7 +2101,7 @@ SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v1` (
|
||||
`a` int(11)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
/*!50001 DROP TABLE `v1`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
@ -2170,7 +2175,7 @@ SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` varchar(30)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
/*!50001 DROP TABLE `v2`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
@ -2286,7 +2291,7 @@ SET character_set_client = utf8;
|
||||
`a` int(11),
|
||||
`b` int(11),
|
||||
`c` varchar(30)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
DROP TABLE IF EXISTS `v2`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
@ -2294,7 +2299,7 @@ SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` int(11)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
DROP TABLE IF EXISTS `v3`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v3`*/;
|
||||
@ -2304,7 +2309,7 @@ SET character_set_client = utf8;
|
||||
`a` int(11),
|
||||
`b` int(11),
|
||||
`c` varchar(30)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
/*!50001 DROP TABLE `v1`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
@ -3041,7 +3046,7 @@ SET character_set_client = utf8;
|
||||
`a` int(11),
|
||||
`b` varchar(32),
|
||||
`c` varchar(32)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
DROP TABLE IF EXISTS `v1`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
@ -3051,7 +3056,7 @@ SET character_set_client = utf8;
|
||||
`a` int(11),
|
||||
`b` varchar(32),
|
||||
`c` varchar(32)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
DROP TABLE IF EXISTS `v2`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
@ -3061,7 +3066,7 @@ SET character_set_client = utf8;
|
||||
`a` int(11),
|
||||
`b` varchar(32),
|
||||
`c` varchar(32)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
USE `test`;
|
||||
@ -3441,7 +3446,7 @@ SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v1` (
|
||||
`id` int(11)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
USE `mysqldump_test_db`;
|
||||
@ -3501,7 +3506,7 @@ SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `nasishnasifu` (
|
||||
`id` bigint(20) unsigned
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
USE `mysqldump_tables`;
|
||||
@ -3959,7 +3964,7 @@ SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v1` (
|
||||
`id` int(11)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
USE `mysqldump_test_db`;
|
||||
@ -4089,6 +4094,7 @@ DROP DATABASE mysqldump_test_db;
|
||||
|
||||
# -- End of test case for Bug#32538.
|
||||
|
||||
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
|
@ -742,3 +742,23 @@ WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p407,p408,p409,p507,p508,p509 ALL NULL NULL NULL NULL 18 Using where
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
CREATE TABLE t2 (
|
||||
defid int(10) unsigned NOT NULL,
|
||||
day int(10) unsigned NOT NULL,
|
||||
count int(10) unsigned NOT NULL,
|
||||
filler char(200),
|
||||
KEY (defid,day)
|
||||
)
|
||||
PARTITION BY RANGE (day) (
|
||||
PARTITION p7 VALUES LESS THAN (20070401) ,
|
||||
PARTITION p8 VALUES LESS THAN (20070501));
|
||||
insert into t2 select 20, 20070311, 1, 'filler' from t1 A, t1 B;
|
||||
insert into t2 select 20, 20070411, 1, 'filler' from t1 A, t1 B;
|
||||
insert into t2 values(52, 20070321, 123, 'filler') ;
|
||||
insert into t2 values(52, 20070322, 456, 'filler') ;
|
||||
select sum(count) from t2 ch where ch.defid in (50,52) and ch.day between 20070320 and 20070401 group by defid;
|
||||
sum(count)
|
||||
579
|
||||
drop table t1, t2;
|
||||
|
6
mysql-test/r/skip_log_bin.result
Normal file
6
mysql-test/r/skip_log_bin.result
Normal file
@ -0,0 +1,6 @@
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
set @@session.binlog_format=row;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
create table t2 select * from t1;
|
||||
drop table t1, t2;
|
@ -1628,6 +1628,13 @@ end loop label1;
|
||||
end loop;
|
||||
end|
|
||||
ERROR 42000: End-label label1 without match
|
||||
CREATE TABLE t1 (a INT)|
|
||||
INSERT INTO t1 VALUES (1),(2)|
|
||||
CREATE PROCEDURE p1(a INT) BEGIN END|
|
||||
CALL p1((SELECT * FROM t1))|
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
DROP PROCEDURE IF EXISTS p1|
|
||||
DROP TABLE t1|
|
||||
drop procedure if exists p1;
|
||||
create procedure p1()
|
||||
begin
|
||||
|
@ -6836,6 +6836,16 @@ drop procedure p1;
|
||||
drop function f1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
drop procedure if exists `p2` $
|
||||
create procedure `p2`(in `a` text charset utf8)
|
||||
begin
|
||||
declare `pos` int default 1;
|
||||
declare `str` text charset utf8;
|
||||
set `str` := `a`;
|
||||
select substr(`str`, `pos`+ 1 ) into `str`;
|
||||
end $
|
||||
call `p2`('s s s s s s');
|
||||
drop procedure `p2`;
|
||||
# ------------------------------------------------------------------
|
||||
# -- End of 5.0 tests
|
||||
# ------------------------------------------------------------------
|
||||
|
@ -121,8 +121,8 @@ select @a:=0;
|
||||
select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
|
||||
@a+0 @a:=@a+0+count(*) count(*) @a+0
|
||||
0 1 1 0
|
||||
1 3 2 0
|
||||
3 6 3 0
|
||||
0 2 2 0
|
||||
0 3 3 0
|
||||
set @a=0;
|
||||
select @a,@a:="hello",@a,@a:=3,@a,@a:="hello again" from t1 group by i;
|
||||
@a @a:="hello" @a @a:=3 @a @a:="hello again"
|
||||
@ -370,4 +370,33 @@ select @rownum := @rownum + 1 as row,
|
||||
@prev_score := a as score
|
||||
from t1 order by score desc;
|
||||
drop table t1;
|
||||
create table t1(b bigint);
|
||||
insert into t1 (b) values (10), (30), (10);
|
||||
set @var := 0;
|
||||
select if(b=@var, 999, b) , @var := b from t1 order by b;
|
||||
if(b=@var, 999, b) @var := b
|
||||
10 10
|
||||
999 10
|
||||
30 30
|
||||
drop table t1;
|
||||
create temporary table t1 (id int);
|
||||
insert into t1 values (2), (3), (3), (4);
|
||||
set @lastid=-1;
|
||||
select @lastid != id, @lastid, @lastid := id from t1;
|
||||
@lastid != id @lastid @lastid := id
|
||||
1 -1 2
|
||||
1 2 3
|
||||
0 3 3
|
||||
1 3 4
|
||||
drop table t1;
|
||||
create temporary table t1 (id bigint);
|
||||
insert into t1 values (2), (3), (3), (4);
|
||||
set @lastid=-1;
|
||||
select @lastid != id, @lastid, @lastid := id from t1;
|
||||
@lastid != id @lastid @lastid := id
|
||||
1 -1 2
|
||||
1 2 3
|
||||
0 3 3
|
||||
1 3 4
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
25
mysql-test/suite/binlog/r/binlog_mix_innodb_stat.result
Normal file
25
mysql-test/suite/binlog/r/binlog_mix_innodb_stat.result
Normal file
@ -0,0 +1,25 @@
|
||||
flush status;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 0
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 0
|
||||
drop table if exists t1;
|
||||
create table t1 (a int) engine=innodb;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 1
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
begin;
|
||||
delete from t1;
|
||||
commit;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 2
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
drop table t1;
|
@ -1090,6 +1090,53 @@ master-bin.000001 295 Table_map 1 337 table_id: # (test.t1)
|
||||
master-bin.000001 337 Write_rows 1 383 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 383 Query 1 452 use `test`; COMMIT
|
||||
master-bin.000001 452 Query 1 528 use `test`; drop table t1
|
||||
reset master;
|
||||
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
|
||||
USE bug39182;
|
||||
CREATE TABLE t1 (a VARCHAR(255) COLLATE utf8_unicode_ci)
|
||||
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE s1 VARCHAR(255);
|
||||
SET s1= "test";
|
||||
CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", s1, "%");
|
||||
SELECT
|
||||
COLLATION(NAME_CONST('s1', _utf8'test')) c1,
|
||||
COLLATION(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) c2,
|
||||
COLLATION(s1) c3,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test')) d1,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
|
||||
COERCIBILITY(s1) d3;
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
END//
|
||||
CALL p1();
|
||||
c1 c2 c3 d1 d2 d3
|
||||
utf8_general_ci utf8_unicode_ci utf8_unicode_ci 2 2 2
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
|
||||
master-bin.000001 # Query # # use `bug39182`; CREATE TABLE t1 (a VARCHAR(255) COLLATE utf8_unicode_ci)
|
||||
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
master-bin.000001 # Query # # use `bug39182`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
BEGIN
|
||||
DECLARE s1 VARCHAR(255);
|
||||
SET s1= "test";
|
||||
CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", s1, "%");
|
||||
SELECT
|
||||
COLLATION(NAME_CONST('s1', _utf8'test')) c1,
|
||||
COLLATION(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) c2,
|
||||
COLLATION(s1) c3,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test')) d1,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
|
||||
COERCIBILITY(s1) d3;
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
END
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug39182;
|
||||
USE test;
|
||||
End of 5.0 tests
|
||||
reset master;
|
||||
create table t1 (id tinyint auto_increment primary key);
|
||||
|
@ -1,3 +1,4 @@
|
||||
flush status;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 0
|
||||
@ -22,18 +23,3 @@ show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
drop table t1;
|
||||
show status like "Innodb_buffer_pool_pages_total";
|
||||
Variable_name Value
|
||||
Innodb_buffer_pool_pages_total 512
|
||||
show status like "Innodb_page_size";
|
||||
Variable_name Value
|
||||
Innodb_page_size 16384
|
||||
show status like "Innodb_rows_deleted";
|
||||
Variable_name Value
|
||||
Innodb_rows_deleted 2000
|
||||
show status like "Innodb_rows_inserted";
|
||||
Variable_name Value
|
||||
Innodb_rows_inserted 2000
|
||||
show status like "Innodb_rows_updated";
|
||||
Variable_name Value
|
||||
Innodb_rows_updated 0
|
||||
|
@ -594,6 +594,56 @@ master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
|
||||
master-bin.000001 106 Query 1 227 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
|
||||
master-bin.000001 227 Query 1 351 use `test`; insert into t1 values (9999999999999999,14632475938453979136)
|
||||
master-bin.000001 351 Query 1 427 use `test`; drop table t1
|
||||
reset master;
|
||||
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
|
||||
USE bug39182;
|
||||
CREATE TABLE t1 (a VARCHAR(255) COLLATE utf8_unicode_ci)
|
||||
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE s1 VARCHAR(255);
|
||||
SET s1= "test";
|
||||
CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", s1, "%");
|
||||
SELECT
|
||||
COLLATION(NAME_CONST('s1', _utf8'test')) c1,
|
||||
COLLATION(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) c2,
|
||||
COLLATION(s1) c3,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test')) d1,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
|
||||
COERCIBILITY(s1) d3;
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
END//
|
||||
CALL p1();
|
||||
c1 c2 c3 d1 d2 d3
|
||||
utf8_general_ci utf8_unicode_ci utf8_unicode_ci 2 2 2
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
|
||||
master-bin.000001 # Query # # use `bug39182`; CREATE TABLE t1 (a VARCHAR(255) COLLATE utf8_unicode_ci)
|
||||
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
master-bin.000001 # Query # # use `bug39182`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
BEGIN
|
||||
DECLARE s1 VARCHAR(255);
|
||||
SET s1= "test";
|
||||
CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", s1, "%");
|
||||
SELECT
|
||||
COLLATION(NAME_CONST('s1', _utf8'test')) c1,
|
||||
COLLATION(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) c2,
|
||||
COLLATION(s1) c3,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test')) d1,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
|
||||
COERCIBILITY(s1) d3;
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
END
|
||||
master-bin.000001 # Query # # use `bug39182`; CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", NAME_CONST('s1',_utf8'test' COLLATE 'utf8_unicode_ci'), "%")
|
||||
master-bin.000001 # Query # # use `bug39182`; DROP TEMPORARY TABLE tmp1
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug39182;
|
||||
USE test;
|
||||
End of 5.0 tests
|
||||
reset master;
|
||||
create table t1 (id tinyint auto_increment primary key);
|
||||
|
@ -1,3 +1,4 @@
|
||||
flush status;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 0
|
||||
@ -22,18 +23,3 @@ show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
drop table t1;
|
||||
show status like "Innodb_buffer_pool_pages_total";
|
||||
Variable_name Value
|
||||
Innodb_buffer_pool_pages_total 512
|
||||
show status like "Innodb_page_size";
|
||||
Variable_name Value
|
||||
Innodb_page_size 16384
|
||||
show status like "Innodb_rows_deleted";
|
||||
Variable_name Value
|
||||
Innodb_rows_deleted 2000
|
||||
show status like "Innodb_rows_inserted";
|
||||
Variable_name Value
|
||||
Innodb_rows_inserted 2000
|
||||
show status like "Innodb_rows_updated";
|
||||
Variable_name Value
|
||||
Innodb_rows_updated 0
|
||||
|
71
mysql-test/suite/binlog/r/binlog_stm_row.result
Normal file
71
mysql-test/suite/binlog/r/binlog_stm_row.result
Normal file
@ -0,0 +1,71 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
SET GLOBAL BINLOG_FORMAT = STATEMENT;
|
||||
SET SESSION BINLOG_FORMAT = STATEMENT;
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
select @@SESSION.BINLOG_FORMAT;
|
||||
@@SESSION.BINLOG_FORMAT
|
||||
STATEMENT
|
||||
INSERT INTO t1 VALUES(1);
|
||||
INSERT INTO t2 VALUES(2);
|
||||
#
|
||||
# Ensure that INSERT INTO .. SELECT FROM under SBR takes a read
|
||||
# lock that will prevent the source table from being modified.
|
||||
#
|
||||
# con1
|
||||
SELECT GET_LOCK('Bug#34306', 120);
|
||||
GET_LOCK('Bug#34306', 120)
|
||||
1
|
||||
# con2
|
||||
PREPARE stmt FROM "INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)";
|
||||
EXECUTE stmt;;
|
||||
# default
|
||||
INSERT INTO t2 VALUES (3);;
|
||||
# con1
|
||||
SELECT RELEASE_LOCK('Bug#34306');
|
||||
RELEASE_LOCK('Bug#34306')
|
||||
1
|
||||
# con2
|
||||
SELECT RELEASE_LOCK('Bug#34306');
|
||||
RELEASE_LOCK('Bug#34306')
|
||||
1
|
||||
# default
|
||||
#
|
||||
# Ensure that INSERT INTO .. SELECT FROM prepared under SBR does
|
||||
# not prevent the source table from being modified if under RBR.
|
||||
#
|
||||
# con2
|
||||
SET SESSION BINLOG_FORMAT = ROW;
|
||||
# con1
|
||||
SELECT GET_LOCK('Bug#34306', 120);
|
||||
GET_LOCK('Bug#34306', 120)
|
||||
1
|
||||
# con2
|
||||
EXECUTE stmt;;
|
||||
# default
|
||||
# con1
|
||||
INSERT INTO t2 VALUES (4);
|
||||
SELECT RELEASE_LOCK('Bug#34306');
|
||||
RELEASE_LOCK('Bug#34306')
|
||||
1
|
||||
# con2
|
||||
# default
|
||||
# Show binlog events
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 LIKE t1
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(1)
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES(2)
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (3)
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (4)
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
@ -33,7 +33,7 @@ let $error_code= `select @a like "%#%error_code=0%" /* must return 1 */`;
|
||||
eval select $error_code /* must return 1 as query completed before got killed*/;
|
||||
|
||||
# cleanup for the sub-case
|
||||
system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
|
||||
|
||||
|
||||
#
|
||||
@ -61,7 +61,7 @@ let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
|
||||
eval select $error_code /* must return 0 to mean the killed query is in */;
|
||||
|
||||
# cleanup for the sub-case
|
||||
system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
|
||||
|
||||
|
||||
drop table t1,t2;
|
||||
|
5
mysql-test/suite/binlog/t/binlog_mix_innodb_stat.test
Normal file
5
mysql-test/suite/binlog/t/binlog_mix_innodb_stat.test
Normal file
@ -0,0 +1,5 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_mixed.inc
|
||||
-- source extra/binlog_tests/innodb_stat.test
|
@ -21,4 +21,4 @@ select * from t2;
|
||||
|
||||
# clean up
|
||||
drop table t1,t2;
|
||||
#--system rm $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog
|
||||
#--remove_file $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog
|
||||
|
@ -1,5 +1,5 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
-- source extra/binlog_tests/innodb_stat.test
|
||||
|
107
mysql-test/suite/binlog/t/binlog_stm_row.test
Normal file
107
mysql-test/suite/binlog/t/binlog_stm_row.test
Normal file
@ -0,0 +1,107 @@
|
||||
--source include/have_log_bin.inc
|
||||
--source include/have_binlog_format_row_or_statement.inc
|
||||
|
||||
# Get rid of previous tests binlog
|
||||
--disable_query_log
|
||||
reset master;
|
||||
--enable_query_log
|
||||
|
||||
#
|
||||
# Bug#34306: Can't make copy of log tables when server binary log is enabled
|
||||
#
|
||||
# This is an additional test for Bug#34306 in order to ensure that INSERT INTO
|
||||
# .. SELECT FROM is properly replicated under SBR and RBR and that the proper
|
||||
# read lock type are acquired.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
SET GLOBAL BINLOG_FORMAT = STATEMENT;
|
||||
SET SESSION BINLOG_FORMAT = STATEMENT;
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
select @@SESSION.BINLOG_FORMAT;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
INSERT INTO t2 VALUES(2);
|
||||
|
||||
--connect(con1,localhost,root,,)
|
||||
--connect(con2,localhost,root,,)
|
||||
|
||||
--echo #
|
||||
--echo # Ensure that INSERT INTO .. SELECT FROM under SBR takes a read
|
||||
--echo # lock that will prevent the source table from being modified.
|
||||
--echo #
|
||||
|
||||
--connection con1
|
||||
--echo # con1
|
||||
SELECT GET_LOCK('Bug#34306', 120);
|
||||
--connection con2
|
||||
--echo # con2
|
||||
PREPARE stmt FROM "INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)";
|
||||
--send EXECUTE stmt;
|
||||
--connection default
|
||||
--echo # default
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE
|
||||
state = "User lock" AND
|
||||
info = "INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)";
|
||||
--source include/wait_condition.inc
|
||||
--send INSERT INTO t2 VALUES (3);
|
||||
--connection con1
|
||||
--echo # con1
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE
|
||||
state = "Locked" and info = "INSERT INTO t2 VALUES (3)";
|
||||
--source include/wait_condition.inc
|
||||
SELECT RELEASE_LOCK('Bug#34306');
|
||||
--connection con2
|
||||
--echo # con2
|
||||
--reap
|
||||
SELECT RELEASE_LOCK('Bug#34306');
|
||||
--connection default
|
||||
--echo # default
|
||||
--reap
|
||||
|
||||
--echo #
|
||||
--echo # Ensure that INSERT INTO .. SELECT FROM prepared under SBR does
|
||||
--echo # not prevent the source table from being modified if under RBR.
|
||||
--echo #
|
||||
|
||||
--connection con2
|
||||
--echo # con2
|
||||
SET SESSION BINLOG_FORMAT = ROW;
|
||||
--connection con1
|
||||
--echo # con1
|
||||
SELECT GET_LOCK('Bug#34306', 120);
|
||||
--connection con2
|
||||
--echo # con2
|
||||
--send EXECUTE stmt;
|
||||
--connection default
|
||||
--echo # default
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE
|
||||
state = "User lock" AND
|
||||
info = "INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)";
|
||||
--source include/wait_condition.inc
|
||||
--connection con1
|
||||
--echo # con1
|
||||
INSERT INTO t2 VALUES (4);
|
||||
SELECT RELEASE_LOCK('Bug#34306');
|
||||
--connection con2
|
||||
--echo # con2
|
||||
--reap
|
||||
|
||||
--disconnect con1
|
||||
--disconnect con2
|
||||
--connection default
|
||||
--echo # default
|
||||
|
||||
--echo # Show binlog events
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
@ -16,7 +16,7 @@
|
||||
# That means our SHOW PROCESSLIST can come too early. #
|
||||
# Solution: #
|
||||
# Close the connections at the end of the test. #
|
||||
# Example2: #
|
||||
# Example2 (2008-08-14 again observed): #
|
||||
# 1. connection X: SHOW PROCESSLIST/GRANT ... etc. #
|
||||
# 2. Switch to connection Y #
|
||||
# 3. SHOW PROCESSLIST might present a record like #
|
||||
@ -53,9 +53,11 @@
|
||||
# WL#3982 Test information_schema.processlist #
|
||||
# #
|
||||
# Last update: #
|
||||
# 2008-04-14 pcrews replace HOST to account for Windows' use of #
|
||||
# localhost (host:<port> causing diffs on Windows #
|
||||
# test runs #
|
||||
# 2008-08-14 mleich Bug#38270 Test "processlist_priv_ps" fails on #
|
||||
# varying "processlist" output #
|
||||
# - Replace one sleep by a poll routines #
|
||||
# - Remove or disable superfluous sleeps #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
# The following variables are used in "datadict_priv.inc" and here.
|
||||
@ -87,15 +89,28 @@ USE information_schema;
|
||||
--echo 1 Prepare test.
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
if (`SELECT COUNT(*) <> 1 FROM processlist`)
|
||||
{
|
||||
--echo This test expects one connection to the server.
|
||||
--echo Expectation: USER HOST DB COMMAND STATE INFO
|
||||
--echo Expectation: root localhost information_schema Query executing SELECT USER,HOST,DB,COMMAND,STATE,INFO FROM processlist ORDER BY ID
|
||||
--echo But we found in the moment:
|
||||
SELECT USER,HOST,DB,COMMAND,STATE,INFO FROM processlist ORDER BY ID;
|
||||
--echo Maybe
|
||||
--echo - the base configuration (no of parallel auxiliary sessions) of the server has changed
|
||||
--echo - a parallel test intended for another server accidently connected to our current one
|
||||
--echo We cannot proceed in this situation. Abort
|
||||
exit;
|
||||
}
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 1.1 Create two user
|
||||
--echo ####################################################################################
|
||||
# access to info tables as normal user
|
||||
--disable_abort_on_error
|
||||
--error 0, ER_CANNOT_USER
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
--error 0, ER_CANNOT_USER
|
||||
DROP USER ddicttestuser2@'localhost';
|
||||
--enable_abort_on_error
|
||||
CREATE USER ddicttestuser1@'localhost';
|
||||
CREATE USER ddicttestuser2@'localhost';
|
||||
SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass');
|
||||
@ -112,6 +127,14 @@ connect (con100,localhost,ddicttestuser1,ddictpass,information_schema);
|
||||
--echo SHOW/SELECT shows all processes/threads.
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
# Avoid Bug#38270 Test "processlist_priv_ps" fails on varying "processlist" output
|
||||
# This subtest expects that the connection con100 is in state 'Sleep'.
|
||||
# Poll till the connection con100 is in state COMMAND = 'Sleep'.
|
||||
let $wait_timeout= 10;
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1';
|
||||
--source include/wait_condition.inc
|
||||
eval SHOW CREATE TABLE $table;
|
||||
--replace_column 1 ID 3 HOST_NAME 6 TIME
|
||||
eval SHOW $table;
|
||||
@ -120,7 +143,6 @@ eval SELECT * FROM $table $select_where ORDER BY id;
|
||||
--replace_column 1 ID 3 HOST_NAME 6 TIME
|
||||
eval SELECT $columns FROM $table $select_where ORDER BY id;
|
||||
--source suite/funcs_1/datadict/datadict_priv.inc
|
||||
--real_sleep 0.3
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
@ -128,6 +150,9 @@ eval SELECT $columns FROM $table $select_where ORDER BY id;
|
||||
connection con100;
|
||||
--echo SHOW/SELECT shows only the processes (1) of the user.
|
||||
--echo ####################################################################################
|
||||
# No need for poll routine here.
|
||||
# The current state of the default session might depend on load of testing box
|
||||
# but "ddicttestuser1" must not see anything of the root session.
|
||||
eval SHOW CREATE TABLE $table;
|
||||
--replace_column 1 ID 3 HOST_NAME 6 TIME
|
||||
eval SHOW $table;
|
||||
@ -219,7 +244,7 @@ SELECT * FROM information_schema.processlist;
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 7 Revoke PROCESS privilege from anonymous user + disconnect ddicttestuser1
|
||||
--echo 7 Revoke PROCESS privilege from anonymous user
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
|
@ -7,9 +7,7 @@ connection default (user=root)
|
||||
1.1 Create two user
|
||||
####################################################################################
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
ERROR HY000: Operation DROP USER failed for 'ddicttestuser1'@'localhost'
|
||||
DROP USER ddicttestuser2@'localhost';
|
||||
ERROR HY000: Operation DROP USER failed for 'ddicttestuser2'@'localhost'
|
||||
CREATE USER ddicttestuser1@'localhost';
|
||||
CREATE USER ddicttestuser2@'localhost';
|
||||
SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass');
|
||||
@ -240,7 +238,7 @@ ID ddicttestuser1 HOST_NAME information_schema Query TIME executing SELECT * FRO
|
||||
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL
|
||||
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
7 Revoke PROCESS privilege from anonymous user + disconnect ddicttestuser1
|
||||
7 Revoke PROCESS privilege from anonymous user
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM ''@'localhost';
|
||||
|
@ -7,9 +7,7 @@ connection default (user=root)
|
||||
1.1 Create two user
|
||||
####################################################################################
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
ERROR HY000: Operation DROP USER failed for 'ddicttestuser1'@'localhost'
|
||||
DROP USER ddicttestuser2@'localhost';
|
||||
ERROR HY000: Operation DROP USER failed for 'ddicttestuser2'@'localhost'
|
||||
CREATE USER ddicttestuser1@'localhost';
|
||||
CREATE USER ddicttestuser2@'localhost';
|
||||
SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass');
|
||||
@ -240,7 +238,7 @@ ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * F
|
||||
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL
|
||||
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
7 Revoke PROCESS privilege from anonymous user + disconnect ddicttestuser1
|
||||
7 Revoke PROCESS privilege from anonymous user
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM ''@'localhost';
|
||||
|
@ -354,16 +354,52 @@ select * from t1 where a = 12;
|
||||
a b c
|
||||
12 403 NULL
|
||||
drop table t1;
|
||||
create table t1 (a int not null, b varchar(10)) engine=ndb;
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
create table t1(a int not null) engine=ndb;
|
||||
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
PRIMARY KEY($PK) - UniqueHashIndex
|
||||
insert into t1 values (1),(2),(3);
|
||||
alter table t1 add primary key (a);
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 0 PRIMARY 1 a A 0 NULL NULL BTREE
|
||||
a Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
PRIMARY KEY(a) - UniqueHashIndex
|
||||
PRIMARY(a) - OrderedIndex
|
||||
update t1 set a = 17 where a = 1;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
2
|
||||
3
|
||||
17
|
||||
alter table t1 drop primary key;
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
PRIMARY KEY($PK) - UniqueHashIndex
|
||||
update t1 set a = 1 where a = 17;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
drop table t1;
|
||||
create table t1(a int not null) engine=ndb;
|
||||
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
PRIMARY KEY($PK) - UniqueHashIndex
|
||||
insert into t1 values (1),(2),(3);
|
||||
create unique index pk on t1(a);
|
||||
a Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
PRIMARY KEY(a) - UniqueHashIndex
|
||||
update t1 set a = 17 where a = 1;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
2
|
||||
3
|
||||
17
|
||||
alter table t1 drop index pk;
|
||||
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
PRIMARY KEY($PK) - UniqueHashIndex
|
||||
update t1 set a = 1 where a = 17;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
drop table t1;
|
||||
create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
|
||||
show create table t1;
|
||||
|
@ -411,13 +411,32 @@ select * from t1 where a = 12;
|
||||
drop table t1;
|
||||
|
||||
# some other ALTER combinations
|
||||
# add/drop pk
|
||||
create table t1 (a int not null, b varchar(10)) engine=ndb;
|
||||
show index from t1;
|
||||
# Check add/drop primary key (not supported on-line)
|
||||
create table t1(a int not null) engine=ndb;
|
||||
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY
|
||||
insert into t1 values (1),(2),(3);
|
||||
alter table t1 add primary key (a);
|
||||
show index from t1;
|
||||
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY
|
||||
update t1 set a = 17 where a = 1;
|
||||
select * from t1 order by a;
|
||||
alter table t1 drop primary key;
|
||||
show index from t1;
|
||||
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY
|
||||
update t1 set a = 1 where a = 17;
|
||||
select * from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
# bug#31233 mysql_alter_table() fails to drop UNIQUE KEY
|
||||
create table t1(a int not null) engine=ndb;
|
||||
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY
|
||||
insert into t1 values (1),(2),(3);
|
||||
create unique index pk on t1(a);
|
||||
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY
|
||||
update t1 set a = 17 where a = 1;
|
||||
select * from t1 order by a;
|
||||
alter table t1 drop index pk;
|
||||
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY
|
||||
update t1 set a = 1 where a = 17;
|
||||
select * from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
# alter .. alter
|
||||
|
@ -134,10 +134,14 @@ insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
|
||||
--let ndb_restore_filter=test t1
|
||||
--source include/ndb_backup_print.inc
|
||||
|
||||
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1.txt
|
||||
--exec rm -f $MYSQLTEST_VARDIR/tmp/t2.txt
|
||||
--exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt
|
||||
--exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt
|
||||
--error 0,1
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
|
||||
--error 0,1
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt
|
||||
--error 0,1
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/t3.txt
|
||||
--error 0,1
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/t4.txt
|
||||
|
||||
--let ndb_restore_opts=--verbose=0 --print_data --hex --tab $MYSQLTEST_VARDIR/tmp --append
|
||||
--let ndb_restore_filter=test
|
||||
@ -156,10 +160,10 @@ insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
|
||||
--source include/show_msg.inc
|
||||
--exec sort $MYSQLTEST_VARDIR/tmp/t4.txt
|
||||
|
||||
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1.txt
|
||||
--exec rm -f $MYSQLTEST_VARDIR/tmp/t2.txt
|
||||
--exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt
|
||||
--exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/t3.txt
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/t4.txt
|
||||
|
||||
# now test some other datatypes
|
||||
drop table t1;
|
||||
|
@ -113,7 +113,7 @@ flush tables;
|
||||
# Remove the frm file from disk
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm
|
||||
|
||||
--error 1050
|
||||
--error ER_TABLE_EXISTS_ERROR
|
||||
create table t3(
|
||||
id int not null primary key,
|
||||
name char(20), a int, b float, c char(24)
|
||||
@ -204,13 +204,13 @@ system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS
|
||||
|
||||
#
|
||||
# Test that correct error is returned
|
||||
--error 1146
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t4;
|
||||
--error 1146
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t4;
|
||||
|
||||
show status like 'handler_discover%';
|
||||
--error 1051
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table t4;
|
||||
|
||||
create table t4(
|
||||
@ -223,14 +223,14 @@ select * from t4;
|
||||
# Remove the table from NDB
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS_OUTPUT ;
|
||||
|
||||
--error 1146
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t4;
|
||||
|
||||
drop table if exists t4;
|
||||
|
||||
# Test that dropping a table that does not exists
|
||||
# on disk or in NDB gives same result as above
|
||||
--error 1051
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table t5;
|
||||
drop table if exists t5;
|
||||
|
||||
@ -257,7 +257,7 @@ system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS
|
||||
|
||||
SHOW TABLES;
|
||||
|
||||
--error 1146
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t4;
|
||||
|
||||
#######################################################
|
||||
@ -342,9 +342,9 @@ show status like 'handler_discover%';
|
||||
|
||||
# Check that t3 or t5 can't be created
|
||||
# frm files for these tables is stilll on disk
|
||||
--error 1050
|
||||
--error ER_TABLE_EXISTS_ERROR
|
||||
create table t3(a int);
|
||||
--error 1050
|
||||
--error ER_TABLE_EXISTS_ERROR
|
||||
create table t5(a int);
|
||||
|
||||
SHOW TABLES LIKE 't%';
|
||||
@ -462,7 +462,7 @@ show tables;
|
||||
create database test2;
|
||||
use test2;
|
||||
show tables;
|
||||
--error 1146
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t1;
|
||||
create table t2 (b int,c longblob) engine=ndb;
|
||||
use test;
|
||||
@ -487,7 +487,7 @@ create table t1 (a int primary key) engine=ndb;
|
||||
select * from t1;
|
||||
--exec $NDB_MGM --no-defaults -e "all restart -n" > /dev/null
|
||||
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --not-started > /dev/null
|
||||
--error 1015
|
||||
--error ER_CANT_LOCK
|
||||
select * from t1;
|
||||
--exec $NDB_MGM --no-defaults -e "all start" > /dev/null
|
||||
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults > /dev/null
|
||||
@ -503,17 +503,17 @@ drop database test_only_ndb_tables;
|
||||
# discovered( for example a table created via NDBAPI)
|
||||
|
||||
# Test disabled since it doesn't work on case insensitive systems
|
||||
#--error 1050
|
||||
#--error ER_TABLE_EXISTS_ERROR
|
||||
#CREATE TABLE sys.SYSTAB_0 (a int);
|
||||
#--error 1105
|
||||
#--error ER_UNKNOWN_ERROR
|
||||
#select * from sys.SYSTAB_0;
|
||||
|
||||
#CREATE TABLE IF NOT EXISTS sys.SYSTAB_0 (a int);
|
||||
#show warnings;
|
||||
#--error 1105
|
||||
#--error ER_UNKNOWN_ERROR
|
||||
#select * from sys.SYSTAB_0;
|
||||
|
||||
#--error 1051
|
||||
#--error ER_BAD_TABLE_ERROR
|
||||
#drop table sys.SYSTAB_0;
|
||||
#drop table IF EXISTS sys.SYSTAB_0;
|
||||
|
||||
|
@ -1,16 +1,17 @@
|
||||
################################################################################
|
||||
# inc/partition_alter2.inc #
|
||||
# inc/partition_alter2_1.inc #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests where the columns used within the partitioning function are altered. #
|
||||
# This routine is only useful for the partition_<feature>_<engine> tests. .#
|
||||
# Part 1: increasing size of column
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: mleich #
|
||||
# Original Date: 2006-03-05 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
# Change Author: MattiasJ #
|
||||
# Change Date: 2008-09-08 #
|
||||
# Change: Splitted the test in two different parts (increasing/decreasing col) #
|
||||
################################################################################
|
||||
|
||||
--echo
|
||||
@ -140,133 +141,6 @@ let $unique= , UNIQUE INDEX uidx (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
|
||||
--echo
|
||||
--echo #========================================================================
|
||||
--echo # 2 Decrease the size of the column used in the partitioning
|
||||
--echo # function and/or PRIMARY KEY and/or UNIQUE INDEX
|
||||
--echo #========================================================================
|
||||
--echo #------------------------------------------------------------------------
|
||||
--echo # 2.1 ALTER column f_int2 not used in partitioning function
|
||||
--echo #------------------------------------------------------------------------
|
||||
# Rule: Only f_int1 is used within the partitioning function
|
||||
# ---> inc/partition_alter_11.inc
|
||||
let $alter= ALTER TABLE t1 MODIFY f_int2 MEDIUMINT;
|
||||
--echo # 2.1.1 no PRIMARY KEY or UNIQUE INDEX exists
|
||||
let $unique= ;
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
#
|
||||
if ($do_pk_tests)
|
||||
{
|
||||
# The value of the direct following test is maybe covered by the test with
|
||||
# the PRIMARY KEY containing two columns.
|
||||
if ($more_pk_ui_tests)
|
||||
{
|
||||
--echo # 2.1.2 PRIMARY KEY exists
|
||||
let $unique= , PRIMARY KEY (f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
}
|
||||
let $unique= , PRIMARY KEY (f_int1,f_int2);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
let $unique= , PRIMARY KEY (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
}
|
||||
#
|
||||
--echo # 2.1.3 UNIQUE INDEX exists
|
||||
# The value of the direct following test is maybe covered by the test with
|
||||
# the UNIQUE INDEX containing two columns.
|
||||
if ($more_pk_ui_tests)
|
||||
{
|
||||
let $unique= , UNIQUE INDEX uidx1 (f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
}
|
||||
let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
let $unique= , UNIQUE INDEX uidx1 (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
#
|
||||
if ($more_pk_ui_tests)
|
||||
{
|
||||
# The value of the tests 2.2 is maybe covered by the tests 2.3
|
||||
--echo #------------------------------------------------------------------------
|
||||
--echo # 2.2 ALTER column f_int1 used in partitioning function
|
||||
--echo #------------------------------------------------------------------------
|
||||
# Rule: Only f_int1 is used within the partitioning function
|
||||
# ---> inc/partition_alter_11.inc
|
||||
let $alter= ALTER TABLE t1 MODIFY f_int1 MEDIUMINT;
|
||||
--echo # 2.2.1 no PRIMARY KEY or UNIQUE INDEX exists
|
||||
let $unique= ;
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
#
|
||||
if ($do_pk_tests)
|
||||
{
|
||||
--echo # 2.2.2 PRIMARY KEY exists
|
||||
let $unique= , PRIMARY KEY (f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
let $unique= , PRIMARY KEY (f_int1,f_int2);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
let $unique= , PRIMARY KEY (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
}
|
||||
#
|
||||
--echo # 2.2.3 UNIQUE INDEX exists
|
||||
let $unique= , UNIQUE INDEX uidx (f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
let $unique= , UNIQUE INDEX uidx (f_int1,f_int2);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
let $unique= , UNIQUE INDEX uidx (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
}
|
||||
#
|
||||
--echo #------------------------------------------------------------------------
|
||||
--echo # 2.3 ALTER column f_int1 and f_int2 used in partitioning function
|
||||
--echo #------------------------------------------------------------------------
|
||||
# Rule: f_int1 and f_int2 is used within the partitioning function
|
||||
# ---> inc/partition_alter_13.inc
|
||||
let $alter= ALTER TABLE t1 MODIFY f_int1 MEDIUMINT, MODIFY f_int2 MEDIUMINT;
|
||||
--echo # 2.3.1 no PRIMARY KEY or UNIQUE INDEX exists
|
||||
let $unique= ;
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
#
|
||||
if ($do_pk_tests)
|
||||
{
|
||||
--echo # 2.3.2 PRIMARY KEY exists
|
||||
# The value of the direct following test is maybe covered by the test with
|
||||
# the PRIMARY KEY containing two columns.
|
||||
if ($more_pk_ui_tests)
|
||||
{
|
||||
let $unique= , PRIMARY KEY (f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
}
|
||||
let $unique= , PRIMARY KEY (f_int1,f_int2);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
let $unique= , PRIMARY KEY (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
}
|
||||
#
|
||||
--echo # 2.3.3 UNIQUE INDEX exists
|
||||
# The value of the direct following test is maybe covered by the test with
|
||||
# the UNIQUE INDEX containing two columns.
|
||||
if ($more_pk_ui_tests)
|
||||
{
|
||||
let $unique= , UNIQUE INDEX uidx (f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
}
|
||||
let $unique= , UNIQUE INDEX uidx (f_int1,f_int2);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
let $unique= , UNIQUE INDEX uidx (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
#
|
||||
|
||||
if (0)
|
||||
{
|
||||
--echo
|
159
mysql-test/suite/parts/inc/partition_alter2_2.inc
Normal file
159
mysql-test/suite/parts/inc/partition_alter2_2.inc
Normal file
@ -0,0 +1,159 @@
|
||||
################################################################################
|
||||
# inc/partition_alter2_2.inc #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests where the columns used within the partitioning function are altered. #
|
||||
# This routine is only useful for the partition_<feature>_<engine> tests. .#
|
||||
# Part 2: decreasing size of column
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: mleich #
|
||||
# Original Date: 2006-03-05 #
|
||||
# Change Author: MattiasJ #
|
||||
# Change Date: 2008-09-08 #
|
||||
# Change: Splitted the test in two different parts (increasing/decreasing col) #
|
||||
################################################################################
|
||||
|
||||
--echo
|
||||
--echo #========================================================================
|
||||
--echo # 2 Decrease the size of the column used in the partitioning
|
||||
--echo # function and/or PRIMARY KEY and/or UNIQUE INDEX
|
||||
--echo #========================================================================
|
||||
--echo #------------------------------------------------------------------------
|
||||
--echo # 2.1 ALTER column f_int2 not used in partitioning function
|
||||
--echo #------------------------------------------------------------------------
|
||||
# Rule: Only f_int1 is used within the partitioning function
|
||||
# ---> inc/partition_alter_11.inc
|
||||
let $alter= ALTER TABLE t1 MODIFY f_int2 MEDIUMINT;
|
||||
--echo # 2.1.1 no PRIMARY KEY or UNIQUE INDEX exists
|
||||
let $unique= ;
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
#
|
||||
if ($do_pk_tests)
|
||||
{
|
||||
# The value of the direct following test is maybe covered by the test with
|
||||
# the PRIMARY KEY containing two columns.
|
||||
if ($more_pk_ui_tests)
|
||||
{
|
||||
--echo # 2.1.2 PRIMARY KEY exists
|
||||
let $unique= , PRIMARY KEY (f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
}
|
||||
let $unique= , PRIMARY KEY (f_int1,f_int2);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
let $unique= , PRIMARY KEY (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
}
|
||||
#
|
||||
--echo # 2.1.3 UNIQUE INDEX exists
|
||||
# The value of the direct following test is maybe covered by the test with
|
||||
# the UNIQUE INDEX containing two columns.
|
||||
if ($more_pk_ui_tests)
|
||||
{
|
||||
let $unique= , UNIQUE INDEX uidx1 (f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
}
|
||||
let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
let $unique= , UNIQUE INDEX uidx1 (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
#
|
||||
if ($more_pk_ui_tests)
|
||||
{
|
||||
# The value of the tests 2.2 is maybe covered by the tests 2.3
|
||||
--echo #------------------------------------------------------------------------
|
||||
--echo # 2.2 ALTER column f_int1 used in partitioning function
|
||||
--echo #------------------------------------------------------------------------
|
||||
# Rule: Only f_int1 is used within the partitioning function
|
||||
# ---> inc/partition_alter_11.inc
|
||||
let $alter= ALTER TABLE t1 MODIFY f_int1 MEDIUMINT;
|
||||
--echo # 2.2.1 no PRIMARY KEY or UNIQUE INDEX exists
|
||||
let $unique= ;
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
#
|
||||
if ($do_pk_tests)
|
||||
{
|
||||
--echo # 2.2.2 PRIMARY KEY exists
|
||||
let $unique= , PRIMARY KEY (f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
let $unique= , PRIMARY KEY (f_int1,f_int2);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
let $unique= , PRIMARY KEY (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
}
|
||||
#
|
||||
--echo # 2.2.3 UNIQUE INDEX exists
|
||||
let $unique= , UNIQUE INDEX uidx (f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
let $unique= , UNIQUE INDEX uidx (f_int1,f_int2);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
let $unique= , UNIQUE INDEX uidx (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
}
|
||||
#
|
||||
--echo #------------------------------------------------------------------------
|
||||
--echo # 2.3 ALTER column f_int1 and f_int2 used in partitioning function
|
||||
--echo #------------------------------------------------------------------------
|
||||
# Rule: f_int1 and f_int2 is used within the partitioning function
|
||||
# ---> inc/partition_alter_13.inc
|
||||
let $alter= ALTER TABLE t1 MODIFY f_int1 MEDIUMINT, MODIFY f_int2 MEDIUMINT;
|
||||
--echo # 2.3.1 no PRIMARY KEY or UNIQUE INDEX exists
|
||||
let $unique= ;
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
#
|
||||
if ($do_pk_tests)
|
||||
{
|
||||
--echo # 2.3.2 PRIMARY KEY exists
|
||||
# The value of the direct following test is maybe covered by the test with
|
||||
# the PRIMARY KEY containing two columns.
|
||||
if ($more_pk_ui_tests)
|
||||
{
|
||||
let $unique= , PRIMARY KEY (f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
}
|
||||
let $unique= , PRIMARY KEY (f_int1,f_int2);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
let $unique= , PRIMARY KEY (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
}
|
||||
#
|
||||
--echo # 2.3.3 UNIQUE INDEX exists
|
||||
# The value of the direct following test is maybe covered by the test with
|
||||
# the UNIQUE INDEX containing two columns.
|
||||
if ($more_pk_ui_tests)
|
||||
{
|
||||
let $unique= , UNIQUE INDEX uidx (f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
}
|
||||
let $unique= , UNIQUE INDEX uidx (f_int1,f_int2);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
let $unique= , UNIQUE INDEX uidx (f_int2,f_int1);
|
||||
--source suite/parts/inc/partition_alter_11.inc
|
||||
--source suite/parts/inc/partition_alter_13.inc
|
||||
#
|
||||
|
||||
if (0)
|
||||
{
|
||||
--echo
|
||||
--echo #========================================================================
|
||||
--echo # 3 ALTER the type of the column used in the partitioning
|
||||
--echo # function and/or PRIMARY KEY and/or UNIQUE INDEX
|
||||
--echo # INTEGER --> FLOAT
|
||||
--echo # INTEGER --> DECIMAL
|
||||
--echo # INTEGER --> VARCHAR
|
||||
--echo # mleich: I assume that at least the first two variants are of
|
||||
--echo # some interest. But I am unsure if the server allows such
|
||||
--echo # conversions. I also think that such operations have a
|
||||
--echo # conversions very small likelihood.
|
||||
--echo # To be implemented.
|
||||
--echo #========================================================================
|
||||
}
|
600
mysql-test/suite/parts/inc/partition_auto_increment.inc
Normal file
600
mysql-test/suite/parts/inc/partition_auto_increment.inc
Normal file
@ -0,0 +1,600 @@
|
||||
# inc/partition_auto_increment.inc
|
||||
#
|
||||
# auto_increment test
|
||||
# used variables: $engine
|
||||
#
|
||||
|
||||
-- disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
-- enable_warnings
|
||||
|
||||
-- echo # test without partitioning for reference
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine;
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
INSERT INTO t1 VALUES (0);
|
||||
-- error 0, ER_DUP_KEY, ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
if (!$skip_update)
|
||||
{
|
||||
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
|
||||
-- error 0, ER_BAD_NULL_ERROR
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
}
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine;
|
||||
SHOW CREATE TABLE t1;
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
if (!$skip_delete)
|
||||
{
|
||||
DELETE FROM t1;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
if (!$skip_truncate)
|
||||
{
|
||||
TRUNCATE TABLE t1;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Simple test with NULL
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test with sql_mode and first insert as 0
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
let $old_sql_mode = `select @@session.sql_mode`;
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
DROP TABLE t1;
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
eval SET @@session.sql_mode = '$old_sql_mode';
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
-- echo # Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
if (!$skip_update)
|
||||
{
|
||||
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
|
||||
-- error 0, ER_BAD_NULL_ERROR
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
}
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test with auto_increment_increment and auto_increment_offset.
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
let $old_increment = `SELECT @@session.auto_increment_increment`;
|
||||
let $old_offset = `SELECT @@session.auto_increment_offset`;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
let $new_val = `SELECT LAST_INSERT_ID()`;
|
||||
eval INSERT INTO t1 VALUES ($new_val + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
let $new_val = `SELECT LAST_INSERT_ID()`;
|
||||
eval INSERT INTO t1 VALUES ($new_val + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
let $new_val = `SELECT LAST_INSERT_ID()`;
|
||||
eval INSERT INTO t1 VALUES ($new_val + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
let $new_val = `SELECT LAST_INSERT_ID()`;
|
||||
eval INSERT INTO t1 VALUES ($new_val + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
let $new_val = `SELECT LAST_INSERT_ID()`;
|
||||
eval INSERT INTO t1 VALUES ($new_val + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
let $new_val = `SELECT LAST_INSERT_ID()`;
|
||||
eval INSERT INTO t1 VALUES ($new_val + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
eval SET @@session.auto_increment_increment = $old_increment;
|
||||
eval SET @@session.auto_increment_offset = $old_offset;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
-- echo # Test reported auto_increment value
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (10);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (15);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
if (!$skip_delete)
|
||||
{
|
||||
DELETE FROM t1;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
if (!$skip_truncate)
|
||||
{
|
||||
TRUNCATE TABLE t1;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test with two threads
|
||||
connection default;
|
||||
-- echo # con default
|
||||
eval CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = $engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
connect(con1, localhost, root,,);
|
||||
connection con1;
|
||||
-- echo # con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
-- echo # con1
|
||||
connection con1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
-- echo # con1
|
||||
connection con1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
disconnect con1;
|
||||
connection default;
|
||||
-- echo # con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test with two threads + start transaction NO PARTITIONING
|
||||
connect(con1, localhost, root,,);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
eval CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = $engine;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
connection con1;
|
||||
-- echo # con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
-- echo # con1
|
||||
connection con1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
-- echo # con1
|
||||
connection con1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
-- echo # con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test with two threads + start transaction
|
||||
connect(con1, localhost, root,,);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
eval CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = $engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
connection con1;
|
||||
-- echo # con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
-- echo # con1
|
||||
connection con1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
-- echo # con1
|
||||
connection con1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
-- echo # con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
if (!$only_ai_pk)
|
||||
{
|
||||
-- echo # Test with another column after
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
c2 INT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = $engine
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2), (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (2, 0), (NULL, 2);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
DROP TABLE t1;
|
||||
}
|
||||
|
||||
-- echo # Test with another column before
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = $engine
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
-- error 0, ER_DUP_KEY, ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
-- error 0, ER_DUP_KEY, ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test with auto_increment on secondary column in multi-column-index
|
||||
-- disable_abort_on_error
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = $engine
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
-- enable_abort_on_error
|
||||
-- disable_query_log
|
||||
eval SET @my_errno= $mysql_errno ;
|
||||
let $run = `SELECT @my_errno = 0`;
|
||||
# ER_WRONG_AUTO_KEY is 1075
|
||||
let $ER_WRONG_AUTO_KEY= 1075;
|
||||
if (`SELECT @my_errno NOT IN (0,$ER_WRONG_AUTO_KEY)`)
|
||||
{
|
||||
-- echo # Unknown error code, exits
|
||||
exit;
|
||||
}
|
||||
-- enable_query_log
|
||||
if ($run)
|
||||
{
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
-- error 0, ER_DUP_KEY, ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL), (2, 0), (2, NULL);
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole/NDB) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (2, 22), (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
DROP TABLE t1;
|
||||
}
|
||||
|
||||
-- echo # Test AUTO_INCREMENT in CREATE
|
||||
eval CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = $engine
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
|
||||
-- echo # Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
let $old_sql_mode = `select @@session.sql_mode`;
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
eval SET @@session.sql_mode = '$old_sql_mode';
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test SET INSERT_ID
|
||||
eval CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = $engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Testing with FLUSH TABLE
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
59281
mysql-test/suite/parts/r/partition_alter2_1_innodb.result
Normal file
59281
mysql-test/suite/parts/r/partition_alter2_1_innodb.result
Normal file
File diff suppressed because it is too large
Load Diff
36885
mysql-test/suite/parts/r/partition_alter2_1_myisam.result
Normal file
36885
mysql-test/suite/parts/r/partition_alter2_1_myisam.result
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
37094
mysql-test/suite/parts/r/partition_alter2_2_myisam.result
Normal file
37094
mysql-test/suite/parts/r/partition_alter2_2_myisam.result
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
747
mysql-test/suite/parts/r/partition_auto_increment_archive.result
Normal file
747
mysql-test/suite/parts/r/partition_auto_increment_archive.result
Normal file
@ -0,0 +1,747 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# test without partitioning for reference
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
30
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=8 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with sql_mode and first insert as 0
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
1 8
|
||||
2 3
|
||||
4 7
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
59
|
||||
60
|
||||
90
|
||||
91
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment_increment and auto_increment_offset.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (33 + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (38 + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (43 + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (48 + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (53 + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (63 + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET @@session.auto_increment_increment = 1;
|
||||
SET @@session.auto_increment_offset = 1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
5
|
||||
15
|
||||
25
|
||||
33
|
||||
34
|
||||
38
|
||||
40
|
||||
43
|
||||
46
|
||||
48
|
||||
52
|
||||
53
|
||||
58
|
||||
63
|
||||
69
|
||||
73
|
||||
DROP TABLE t1;
|
||||
# Test reported auto_increment value
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
INSERT INTO t1 VALUES (10);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
23
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (15);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
DROP TABLE t1;
|
||||
# Test with two threads
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction NO PARTITIONING
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Archive';
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with another column before
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = 'Archive'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 3
|
||||
2 13
|
||||
2 14
|
||||
2 22
|
||||
2 23
|
||||
3 11
|
||||
3 12
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment on secondary column in multi-column-index
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'Archive'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||
# Test AUTO_INCREMENT in CREATE
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Archive'
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
15
|
||||
16
|
||||
# Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
15
|
||||
16
|
||||
300
|
||||
301
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Test SET INSERT_ID
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
23
|
||||
DROP TABLE t1;
|
||||
# Testing with FLUSH TABLE
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
@ -0,0 +1,570 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# test without partitioning for reference
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test with sql_mode and first insert as 0
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment_increment and auto_increment_offset.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (33 + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (38 + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (43 + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (48 + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (53 + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (63 + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET @@session.auto_increment_increment = 1;
|
||||
SET @@session.auto_increment_offset = 1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test reported auto_increment value
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
INSERT INTO t1 VALUES (10);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
23
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (15);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test with two threads
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction NO PARTITIONING
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Blackhole';
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test with another column after
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
c2 INT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'Blackhole'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2), (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (2, 0), (NULL, 2);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
DROP TABLE t1;
|
||||
# Test with another column before
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = 'Blackhole'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment on secondary column in multi-column-index
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'Blackhole'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL), (2, 0), (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
# ERROR (only OK if Blackhole/NDB) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (2, 22), (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
DROP TABLE t1;
|
||||
# Test AUTO_INCREMENT in CREATE
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Blackhole'
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
# Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Test SET INSERT_ID
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Testing with FLUSH TABLE
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
747
mysql-test/suite/parts/r/partition_auto_increment_innodb.result
Normal file
747
mysql-test/suite/parts/r/partition_auto_increment_innodb.result
Normal file
@ -0,0 +1,747 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# test without partitioning for reference
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
20
|
||||
22
|
||||
23
|
||||
25
|
||||
30
|
||||
31
|
||||
32
|
||||
50
|
||||
51
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
6
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with sql_mode and first insert as 0
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 8
|
||||
2 3
|
||||
4 7
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
9
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
55
|
||||
59
|
||||
60
|
||||
90
|
||||
91
|
||||
150
|
||||
151
|
||||
152
|
||||
153
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment_increment and auto_increment_offset.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (33 + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (38 + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (43 + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (48 + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (53 + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (63 + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET @@session.auto_increment_increment = 1;
|
||||
SET @@session.auto_increment_offset = 1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
5
|
||||
15
|
||||
25
|
||||
33
|
||||
34
|
||||
38
|
||||
40
|
||||
43
|
||||
46
|
||||
48
|
||||
52
|
||||
53
|
||||
58
|
||||
63
|
||||
69
|
||||
73
|
||||
DROP TABLE t1;
|
||||
# Test reported auto_increment value
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
INSERT INTO t1 VALUES (10);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
23
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (15);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
15
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
26
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with two threads
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction NO PARTITIONING
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'InnoDB';
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with another column after
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
c2 INT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'InnoDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2), (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (2, 0), (NULL, 2);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
2 0
|
||||
2 1
|
||||
2 2
|
||||
2 22
|
||||
3 2
|
||||
4 3
|
||||
5 3
|
||||
6 2
|
||||
7 2
|
||||
DROP TABLE t1;
|
||||
# Test with another column before
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = 'InnoDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 3
|
||||
2 13
|
||||
2 14
|
||||
2 22
|
||||
2 23
|
||||
3 11
|
||||
3 12
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment on secondary column in multi-column-index
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'InnoDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||
# Test AUTO_INCREMENT in CREATE
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'InnoDB'
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
15
|
||||
16
|
||||
# Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
0
|
||||
4
|
||||
15
|
||||
16
|
||||
300
|
||||
301
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Test SET INSERT_ID
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
23
|
||||
DROP TABLE t1;
|
||||
# Testing with FLUSH TABLE
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
775
mysql-test/suite/parts/r/partition_auto_increment_memory.result
Normal file
775
mysql-test/suite/parts/r/partition_auto_increment_memory.result
Normal file
@ -0,0 +1,775 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# test without partitioning for reference
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
30
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
6
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with sql_mode and first insert as 0
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 8
|
||||
2 3
|
||||
4 7
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
9
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
55
|
||||
59
|
||||
60
|
||||
90
|
||||
91
|
||||
150
|
||||
151
|
||||
152
|
||||
153
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment_increment and auto_increment_offset.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (33 + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (38 + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (43 + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (48 + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (53 + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (63 + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET @@session.auto_increment_increment = 1;
|
||||
SET @@session.auto_increment_offset = 1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
5
|
||||
15
|
||||
25
|
||||
33
|
||||
34
|
||||
38
|
||||
40
|
||||
43
|
||||
46
|
||||
48
|
||||
52
|
||||
53
|
||||
58
|
||||
63
|
||||
69
|
||||
73
|
||||
DROP TABLE t1;
|
||||
# Test reported auto_increment value
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
INSERT INTO t1 VALUES (10);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
23
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (15);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
15
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
26
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
27
|
||||
DROP TABLE t1;
|
||||
# Test with two threads
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction NO PARTITIONING
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Memory';
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with another column after
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
c2 INT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'Memory'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2), (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (2, 0), (NULL, 2);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
2 0
|
||||
2 1
|
||||
2 2
|
||||
2 22
|
||||
3 2
|
||||
4 3
|
||||
5 3
|
||||
6 2
|
||||
7 2
|
||||
DROP TABLE t1;
|
||||
# Test with another column before
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = 'Memory'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 3
|
||||
2 13
|
||||
2 14
|
||||
2 22
|
||||
2 23
|
||||
3 11
|
||||
3 12
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment on secondary column in multi-column-index
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'Memory'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||
# Test AUTO_INCREMENT in CREATE
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Memory'
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
15
|
||||
16
|
||||
# Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
0
|
||||
4
|
||||
15
|
||||
16
|
||||
300
|
||||
301
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Test SET INSERT_ID
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
23
|
||||
DROP TABLE t1;
|
||||
# Testing with FLUSH TABLE
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
794
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
Normal file
794
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
Normal file
@ -0,0 +1,794 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# test without partitioning for reference
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
30
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
6
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with sql_mode and first insert as 0
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 8
|
||||
2 3
|
||||
4 7
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
9
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
55
|
||||
59
|
||||
60
|
||||
90
|
||||
91
|
||||
150
|
||||
151
|
||||
152
|
||||
153
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment_increment and auto_increment_offset.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (33 + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (38 + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (43 + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (48 + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (53 + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (63 + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET @@session.auto_increment_increment = 1;
|
||||
SET @@session.auto_increment_offset = 1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
5
|
||||
15
|
||||
25
|
||||
33
|
||||
34
|
||||
38
|
||||
40
|
||||
43
|
||||
46
|
||||
48
|
||||
52
|
||||
53
|
||||
58
|
||||
63
|
||||
69
|
||||
73
|
||||
DROP TABLE t1;
|
||||
# Test reported auto_increment value
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
INSERT INTO t1 VALUES (10);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
23
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (15);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
15
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
26
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
27
|
||||
DROP TABLE t1;
|
||||
# Test with two threads
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction NO PARTITIONING
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'MyISAM';
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with another column after
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
c2 INT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'MyISAM'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2), (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (2, 0), (NULL, 2);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
2 0
|
||||
2 1
|
||||
2 2
|
||||
2 22
|
||||
3 2
|
||||
4 3
|
||||
5 3
|
||||
6 2
|
||||
7 2
|
||||
DROP TABLE t1;
|
||||
# Test with another column before
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = 'MyISAM'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 3
|
||||
2 13
|
||||
2 14
|
||||
2 22
|
||||
2 23
|
||||
3 11
|
||||
3 12
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment on secondary column in multi-column-index
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'MyISAM'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL), (2, 0), (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22), (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 1
|
||||
2 2
|
||||
2 3
|
||||
2 22
|
||||
2 23
|
||||
3 1
|
||||
3 2
|
||||
DROP TABLE t1;
|
||||
# Test AUTO_INCREMENT in CREATE
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'MyISAM'
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
15
|
||||
16
|
||||
# Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
0
|
||||
4
|
||||
15
|
||||
16
|
||||
300
|
||||
301
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Test SET INSERT_ID
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
23
|
||||
DROP TABLE t1;
|
||||
# Testing with FLUSH TABLE
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
769
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
Normal file
769
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
Normal file
@ -0,0 +1,769 @@
|
||||
SET new=on;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# test without partitioning for reference
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
30
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
6
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with sql_mode and first insert as 0
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 100
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 8
|
||||
2 3
|
||||
4 7
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
9
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
55
|
||||
59
|
||||
60
|
||||
90
|
||||
91
|
||||
150
|
||||
151
|
||||
152
|
||||
153
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment_increment and auto_increment_offset.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (33 + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (38 + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (43 + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (48 + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (53 + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (63 + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET @@session.auto_increment_increment = 1;
|
||||
SET @@session.auto_increment_offset = 1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
5
|
||||
15
|
||||
25
|
||||
33
|
||||
34
|
||||
38
|
||||
40
|
||||
43
|
||||
46
|
||||
48
|
||||
52
|
||||
53
|
||||
58
|
||||
63
|
||||
69
|
||||
73
|
||||
DROP TABLE t1;
|
||||
# Test reported auto_increment value
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
INSERT INTO t1 VALUES (10);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
23
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (15);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
15
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
26
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with two threads
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction NO PARTITIONING
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'NDB';
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with another column after
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
c2 INT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'NDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2), (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (2, 0), (NULL, 2);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
2 0
|
||||
2 1
|
||||
2 2
|
||||
2 22
|
||||
3 2
|
||||
4 3
|
||||
5 3
|
||||
6 2
|
||||
7 2
|
||||
DROP TABLE t1;
|
||||
# Test with another column before
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = 'NDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 3
|
||||
2 13
|
||||
2 14
|
||||
2 22
|
||||
2 23
|
||||
3 11
|
||||
3 12
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment on secondary column in multi-column-index
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'NDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL), (2, 0), (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
# ERROR (only OK if Blackhole/NDB) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (2, 22), (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 2
|
||||
2 3
|
||||
2 6
|
||||
2 7
|
||||
2 22
|
||||
2 23
|
||||
3 4
|
||||
3 5
|
||||
DROP TABLE t1;
|
||||
# Test AUTO_INCREMENT in CREATE
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'NDB'
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
15
|
||||
16
|
||||
# Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
0
|
||||
4
|
||||
15
|
||||
16
|
||||
300
|
||||
301
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Test SET INSERT_ID
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
23
|
||||
DROP TABLE t1;
|
||||
# Testing with FLUSH TABLE
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
@ -1,4 +1,3 @@
|
||||
partition_alter2_ndb : Bug#18735 Not supported
|
||||
partition_basic_ndb : Bug#19899 Crashing the server
|
||||
# http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-limitations-syntax.html
|
||||
partition_bit_ndb : NDB does not support bit column in index
|
||||
|
@ -1,5 +1,5 @@
|
||||
################################################################################
|
||||
# t/partition_alter2_innodb.test #
|
||||
# t/partition_alter2_1_innodb.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around Alter column used in partitioning function #
|
||||
@ -70,7 +70,7 @@ let $MAX_VALUE= (2147483646);
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_alter2.inc
|
||||
--source suite/parts/inc/partition_alter2_1.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute storage engine specific tests
|
@ -1,5 +1,5 @@
|
||||
################################################################################
|
||||
# t/partition_alter2_myisam.test #
|
||||
# t/partition_alter2_1_myisam.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around Alter column used in partitioning function #
|
||||
@ -69,7 +69,7 @@ let $MAX_VALUE= (2147483646);
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_alter2.inc
|
||||
--source suite/parts/inc/partition_alter2_1.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute storage engine specific tests
|
@ -1,9 +1,9 @@
|
||||
################################################################################
|
||||
# t/partition_alter2_ndb.test #
|
||||
# t/partition_alter2_2_innodb.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around Alter column used in partitioning function #
|
||||
# NDB branch #
|
||||
# InnoDB branch #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: mleich #
|
||||
@ -14,7 +14,7 @@
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT NDB SPECIFIC TESTCASES HERE !
|
||||
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
@ -40,35 +40,26 @@ SET @max_row = 20;
|
||||
let $more_trigger_tests= 0;
|
||||
let $more_pk_ui_tests= 0;
|
||||
|
||||
# The server must support partitioning. But NDB is partitioned from the start.
|
||||
# Thats why the next line is set to comment.
|
||||
# --source include/have_partition.inc
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
|
||||
##### Storage engine to be tested
|
||||
--source include/have_ndb.inc
|
||||
let $engine= 'ndbcluster';
|
||||
connection default;
|
||||
--source include/have_innodb.inc
|
||||
let $engine= 'InnoDB';
|
||||
|
||||
# range, list and hash partitioning in ndb requires new_mode
|
||||
--disable_query_log
|
||||
set new=on;
|
||||
--enable_query_log
|
||||
##### Execute the test of "table" files
|
||||
# NDB has no files per PK, UI, ...
|
||||
# InnoDB has no files per PK, UI, ...
|
||||
let $do_file_tests= 0;
|
||||
|
||||
##### Execute PRIMARY KEY tests #####
|
||||
# AFAIK NDB is always partitioned using the explicit defined PRIMARY KEY
|
||||
# or uses an internal one.
|
||||
# AFAIK InnoDB clusters the table around PRIMARY KEYs.
|
||||
let $do_pk_tests= 1;
|
||||
|
||||
##### Assign a big number smaller than the maximum value for partitions #####
|
||||
# and smaller than the maximum value of SIGNED INTEGER
|
||||
# The NDB handler only supports 32 bit integers in VALUES
|
||||
# 2147483647 seems to be too big.
|
||||
let $MAX_VALUE= (2147483646);
|
||||
|
||||
# Generate the prerequisites ($variables, @variables, tables) needed
|
||||
@ -79,7 +70,7 @@ let $MAX_VALUE= (2147483646);
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_alter2.inc
|
||||
--source suite/parts/inc/partition_alter2_2.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute storage engine specific tests
|
79
mysql-test/suite/parts/t/partition_alter2_2_myisam.test
Normal file
79
mysql-test/suite/parts/t/partition_alter2_2_myisam.test
Normal file
@ -0,0 +1,79 @@
|
||||
################################################################################
|
||||
# t/partition_alter2_2_myisam.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around Alter column used in partitioning function #
|
||||
# MyISAM branch #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: mleich #
|
||||
# Original Date: 2006-03-05 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
# Please read the README at the end of inc/partition.pre before changing
|
||||
# any of the variables.
|
||||
#
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# General not engine specific settings and requirements
|
||||
|
||||
##### Options, for debugging support #####
|
||||
let $debug= 0;
|
||||
let $with_partitioning= 1;
|
||||
|
||||
##### Option, for displaying files #####
|
||||
let $ls= 1;
|
||||
|
||||
##### Number of rows for the INSERT/UPDATE/DELETE/SELECT experiments #####
|
||||
# on partioned tables
|
||||
SET @max_row = 20;
|
||||
|
||||
##### Execute more tests #####
|
||||
let $more_trigger_tests= 0;
|
||||
let $more_pk_ui_tests= 0;
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'MyISAM';
|
||||
|
||||
##### Execute the test of "table" files
|
||||
# MyISAM has files per PK, UI, ...
|
||||
let $do_file_tests= 1;
|
||||
|
||||
##### Execute PRIMARY KEY tests #####
|
||||
# AFAIK MyISAM treats PRIMARY KEYs like UNIQUE INDEXes
|
||||
let $do_pk_tests= 0;
|
||||
|
||||
##### Assign a big number smaller than the maximum value for partitions #####
|
||||
# and smaller than the maximum value of SIGNED INTEGER
|
||||
let $MAX_VALUE= (2147483646);
|
||||
|
||||
# Generate the prerequisites ($variables, @variables, tables) needed
|
||||
--source suite/parts/inc/partition.pre
|
||||
|
||||
##### Workarounds for known open engine specific bugs
|
||||
# none
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_alter2_2.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute storage engine specific tests
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Cleanup
|
||||
--source suite/parts/inc/partition_cleanup.inc
|
@ -0,0 +1,40 @@
|
||||
################################################################################
|
||||
# t/partition_auto_increment_archive.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around auto increment column #
|
||||
# Archive branch #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: MattiasJ #
|
||||
# Original Date: 2008-09-02 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
--source include/have_archive.inc
|
||||
# Archve does not support delete
|
||||
let $skip_delete= 1;
|
||||
let $skip_truncate= 1;
|
||||
let $skip_update= 1;
|
||||
let $only_ai_pk= 1;
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'Archive';
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_auto_increment.inc
|
||||
|
@ -0,0 +1,35 @@
|
||||
################################################################################
|
||||
# t/partition_auto_increment_blackhole.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around auto increment column #
|
||||
# Blackhole branch #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: MattiasJ #
|
||||
# Original Date: 2008-09-02 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
--source include/have_blackhole.inc
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'Blackhole';
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_auto_increment.inc
|
||||
|
@ -0,0 +1,35 @@
|
||||
################################################################################
|
||||
# t/partition_auto_increment_innodb.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around auto increment column #
|
||||
# InnoDB branch #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: MattiasJ #
|
||||
# Original Date: 2008-02-12 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'InnoDB';
|
||||
--source include/have_innodb.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_auto_increment.inc
|
||||
|
@ -0,0 +1,34 @@
|
||||
################################################################################
|
||||
# t/partition_auto_increment_memory.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around auto increment column #
|
||||
# Memory branch #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: MattiasJ #
|
||||
# Original Date: 2008-02-12 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'Memory';
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_auto_increment.inc
|
||||
|
@ -0,0 +1,34 @@
|
||||
################################################################################
|
||||
# t/partition_auto_increment_myisam.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around auto increment column #
|
||||
# MyISAM branch #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: MattiasJ #
|
||||
# Original Date: 2008-02-12 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'MyISAM';
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_auto_increment.inc
|
||||
|
41
mysql-test/suite/parts/t/partition_auto_increment_ndb.test
Normal file
41
mysql-test/suite/parts/t/partition_auto_increment_ndb.test
Normal file
@ -0,0 +1,41 @@
|
||||
################################################################################
|
||||
# t/partition_auto_increment_ndb.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around auto increment column #
|
||||
# NDB branch #
|
||||
# #
|
||||
# Note: NDB behavior for auto_increment on secondary column in #
|
||||
# multi-column-index is NOT like MyISAM, instead it uses the same #
|
||||
# behavior as if it was the primary column. #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: MattiasJ #
|
||||
# Original Date: 2008-09-02 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
--source include/have_ndb.inc
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'NDB';
|
||||
connection default;
|
||||
#enable hash partitioning
|
||||
SET new=on;
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_auto_increment.inc
|
||||
|
@ -7,7 +7,7 @@ start slave;
|
||||
stop slave;
|
||||
reset master;
|
||||
reset slave;
|
||||
reset master;
|
||||
start slave;
|
||||
create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
|
||||
insert into t1 values (NULL);
|
||||
drop table t1;
|
||||
@ -113,7 +113,6 @@ Aberdeen
|
||||
Abernathy
|
||||
aberrant
|
||||
aberration
|
||||
start slave;
|
||||
|
||||
let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
|
||||
|
||||
|
@ -7,7 +7,7 @@ start slave;
|
||||
stop slave;
|
||||
reset master;
|
||||
reset slave;
|
||||
reset master;
|
||||
start slave;
|
||||
create table t1(n int not null auto_increment primary key)ENGINE=InnoDB;
|
||||
insert into t1 values (NULL);
|
||||
drop table t1;
|
||||
@ -113,7 +113,6 @@ Aberdeen
|
||||
Abernathy
|
||||
aberrant
|
||||
aberration
|
||||
start slave;
|
||||
|
||||
let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
|
||||
|
||||
|
@ -526,7 +526,7 @@ master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(col VARCHAR(10))
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
|
||||
INSERT INTO t1 VALUES(arg)
|
||||
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test'))
|
||||
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
|
||||
master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
SET @a = 1
|
||||
@ -869,7 +869,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
|
||||
INSERT INTO t1 VALUES(arg)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=t/*!*/;
|
||||
INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test'))
|
||||
INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
|
||||
/*!*/;
|
||||
SET TIMESTAMP=t/*!*/;
|
||||
DROP PROCEDURE p1
|
||||
|
@ -7,7 +7,7 @@ start slave;
|
||||
stop slave;
|
||||
reset master;
|
||||
reset slave;
|
||||
reset master;
|
||||
start slave;
|
||||
create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
|
||||
insert into t1 values (NULL);
|
||||
drop table t1;
|
||||
@ -109,7 +109,6 @@ Aberdeen
|
||||
Abernathy
|
||||
aberrant
|
||||
aberration
|
||||
start slave;
|
||||
|
||||
let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
|
||||
|
||||
|
@ -1,91 +0,0 @@
|
||||
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;
|
||||
**** On Master ****
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
**** On Master ****
|
||||
TRUNCATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
SHOW BINLOG EVENTS;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
|
||||
master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
|
||||
master-bin.000001 223 Query 1 287 BEGIN
|
||||
master-bin.000001 287 Table_map 1 40 table_id: # (test.t1)
|
||||
master-bin.000001 327 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 385 Write_rows 1 157 table_id: #
|
||||
master-bin.000001 444 Write_rows 1 204 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 491 Query 1 556 COMMIT
|
||||
master-bin.000001 556 Query 1 636 use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 636 Query 1 712 use `test`; DROP TABLE t1
|
||||
**** On Master ****
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
**** On Master ****
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
3 3
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
SHOW BINLOG EVENTS;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
|
||||
master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
|
||||
master-bin.000001 223 Query 1 287 BEGIN
|
||||
master-bin.000001 287 Table_map 1 40 table_id: # (test.t1)
|
||||
master-bin.000001 327 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 385 Write_rows 1 157 table_id: #
|
||||
master-bin.000001 444 Write_rows 1 204 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 491 Query 1 556 COMMIT
|
||||
master-bin.000001 556 Query 1 636 use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 636 Query 1 712 use `test`; DROP TABLE t1
|
||||
master-bin.000001 712 Query 1 829 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
|
||||
master-bin.000001 829 Query 1 893 BEGIN
|
||||
master-bin.000001 893 Table_map 1 40 table_id: # (test.t1)
|
||||
master-bin.000001 933 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 991 Write_rows 1 157 table_id: #
|
||||
master-bin.000001 1050 Write_rows 1 204 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 1097 Query 1 1162 COMMIT
|
||||
master-bin.000001 1162 Query 1 1226 BEGIN
|
||||
master-bin.000001 1226 Table_map 1 40 table_id: # (test.t1)
|
||||
master-bin.000001 1266 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 1324 Write_rows 1 157 table_id: #
|
||||
master-bin.000001 1383 Delete_rows 1 196 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 1422 Query 1 1487 COMMIT
|
||||
master-bin.000001 1487 Query 1 1563 use `test`; DROP TABLE t1
|
@ -1 +1 @@
|
||||
|
||||
--log-slave-updates
|
||||
|
@ -1 +0,0 @@
|
||||
--replicate-ignore-table=test.foo
|
@ -7,7 +7,7 @@ start slave;
|
||||
stop slave;
|
||||
reset master;
|
||||
reset slave;
|
||||
reset master;
|
||||
start slave;
|
||||
create table t1(n int not null auto_increment primary key)ENGINE=NDB;
|
||||
insert into t1 values (NULL);
|
||||
drop table t1;
|
||||
@ -117,7 +117,6 @@ Aberdeen
|
||||
Abernathy
|
||||
aberrant
|
||||
aberration
|
||||
start slave;
|
||||
|
||||
let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
|
||||
|
||||
|
91
mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb_2.result
Normal file
91
mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb_2.result
Normal file
@ -0,0 +1,91 @@
|
||||
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;
|
||||
**** On Master ****
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
**** On Master ****
|
||||
TRUNCATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
SHOW BINLOG EVENTS;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
|
||||
master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
|
||||
master-bin.000001 223 Query 1 287 BEGIN
|
||||
master-bin.000001 287 Table_map 1 330 table_id: # (test.t1)
|
||||
master-bin.000001 330 Table_map 1 392 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 392 Write_rows 1 451 table_id: #
|
||||
master-bin.000001 451 Write_rows 1 498 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 498 Query 1 563 COMMIT
|
||||
master-bin.000001 563 Query 1 643 use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 643 Query 1 719 use `test`; DROP TABLE t1
|
||||
**** On Master ****
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
**** On Master ****
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
a b
|
||||
3 3
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
SHOW BINLOG EVENTS;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
|
||||
master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
|
||||
master-bin.000001 223 Query 1 287 BEGIN
|
||||
master-bin.000001 287 Table_map 1 330 table_id: # (test.t1)
|
||||
master-bin.000001 330 Table_map 1 392 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 392 Write_rows 1 451 table_id: #
|
||||
master-bin.000001 451 Write_rows 1 498 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 498 Query 1 563 COMMIT
|
||||
master-bin.000001 563 Query 1 643 use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 643 Query 1 719 use `test`; DROP TABLE t1
|
||||
master-bin.000001 719 Query 1 836 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
|
||||
master-bin.000001 836 Query 1 900 BEGIN
|
||||
master-bin.000001 900 Table_map 1 943 table_id: # (test.t1)
|
||||
master-bin.000001 943 Table_map 1 1005 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 1005 Write_rows 1 1064 table_id: #
|
||||
master-bin.000001 1064 Write_rows 1 1111 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 1111 Query 1 1176 COMMIT
|
||||
master-bin.000001 1176 Query 1 1240 BEGIN
|
||||
master-bin.000001 1240 Table_map 1 1283 table_id: # (test.t1)
|
||||
master-bin.000001 1283 Table_map 1 1345 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 1345 Write_rows 1 1404 table_id: #
|
||||
master-bin.000001 1404 Delete_rows 1 1443 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 1443 Query 1 1508 COMMIT
|
||||
master-bin.000001 1508 Query 1 1584 use `test`; DROP TABLE t1
|
@ -1,6 +1,11 @@
|
||||
# Same test as rpl_truncate_7ndb.test, but with mixed mode
|
||||
# This is marked with 'big_test' just because the rpl_truncate_7ndb test is
|
||||
# so slow...
|
||||
|
||||
# Last Change: 2008-09-03
|
||||
# Change Author: pcrews
|
||||
# Change: Moved test to rpl_ndb suite, updated location of --source .test file
|
||||
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/big_test.inc
|
||||
--source t/rpl_truncate_7ndb.test
|
||||
--source suite/rpl_ndb/t/rpl_truncate_7ndb.test
|
@ -314,5 +314,15 @@ insert into t1 values(null,0,0,null);
|
||||
# this will delete two rows
|
||||
replace into t1 values(null,1,0,null);
|
||||
select last_insert_id();
|
||||
|
||||
drop table t1;
|
||||
|
||||
# Test of REPLACE when it does a INSERT+DELETE for all the conflicting rows
|
||||
# (i.e.) when there are three rows conflicting in unique key columns with
|
||||
# a row that is being inserted, all the three rows will be deleted and then
|
||||
# the new rows will be inserted.
|
||||
create table t1 (a int primary key auto_increment, b int, c int, e int, d timestamp default current_timestamp, unique(b),unique(c),unique(e));
|
||||
insert into t1 values(null,1,1,1,now());
|
||||
insert into t1 values(null,0,0,0,null);
|
||||
replace into t1 values(null,1,0,2,null);
|
||||
select last_insert_id();
|
||||
drop table t1;
|
||||
|
@ -76,4 +76,13 @@ FROM t2 ORDER BY a;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Bug #39353: Multiple conditions on timestamp column crashes server
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a TIMESTAMP);
|
||||
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
|
||||
SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -79,7 +79,8 @@ delete from t1;
|
||||
--eval select hex(load_file('$MYSQLTEST_VARDIR/master-data/test/t1.txt'));
|
||||
load data infile 't1.txt' into table t1;
|
||||
select hex(a) from t1;
|
||||
--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.txt
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.txt
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -678,6 +678,17 @@ select * from t1 where a=if(b<10,_ucs2 0x00C0,_ucs2 0x0062);
|
||||
select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#35720 ucs2 + pad_char_to_full_length = failure
|
||||
#
|
||||
CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET UCS2);
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
SET @@sql_mode=pad_char_to_full_length;
|
||||
SELECT HEX(s1) FROM t1;
|
||||
SET @@sql_mode=default;
|
||||
SELECT HEX(s1) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
set collation_connection=ucs2_general_ci;
|
||||
--source include/ctype_regex.inc
|
||||
set names latin1;
|
||||
|
@ -438,72 +438,71 @@ EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
|
||||
SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
|
||||
|
||||
DROP TABLE t1;
|
||||
# The test case for bug#20836 should be re-enabled when bug#16861 is resolved
|
||||
# The results for the test should be the same as in 4.1.
|
||||
#
|
||||
|
||||
#Bug #20836: Selecting into variables results in wrong results being returned
|
||||
#
|
||||
#--disable_warnings
|
||||
#DROP TABLE IF EXISTS t1;
|
||||
#--enable_warnings
|
||||
#
|
||||
#CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20)
|
||||
#default NULL);
|
||||
#
|
||||
#INSERT INTO t1 VALUES (1,1,'ORANGE');
|
||||
#INSERT INTO t1 VALUES (2,2,'APPLE');
|
||||
#INSERT INTO t1 VALUES (3,2,'APPLE');
|
||||
#INSERT INTO t1 VALUES (4,3,'PEAR');
|
||||
#
|
||||
#SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name =
|
||||
#'APPLE';
|
||||
#SELECT @v1, @v2;
|
||||
#
|
||||
#SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id,
|
||||
#fruit_name HAVING fruit_name = 'APPLE';
|
||||
#SELECT @v3, @v4;
|
||||
#
|
||||
#SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
|
||||
#fruit_name = 'APPLE';
|
||||
#SELECT @v5, @v6, @v7, @v8;
|
||||
#
|
||||
#SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
|
||||
#WHERE fruit_name = 'APPLE';
|
||||
#SELECT @v5, @v6, @v7, @v8, @v9, @v10;
|
||||
#
|
||||
#SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
|
||||
#@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
|
||||
#SELECT @v11, @v12, @v13, @v14;
|
||||
#
|
||||
#SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
|
||||
#SELECT @v15, @v16;
|
||||
#
|
||||
#SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
|
||||
#'APPLE';
|
||||
#SELECT @v17, @v18;
|
||||
#
|
||||
#--disable_warnings
|
||||
#DROP TABLE IF EXISTS t2;
|
||||
#--enable_warnings
|
||||
#
|
||||
#CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
|
||||
#default NULL);
|
||||
#
|
||||
#SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
|
||||
#'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
|
||||
#LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
|
||||
#--exec rm $MYSQL_TEST_DIR/var/tmp/data1.tmp
|
||||
#
|
||||
#SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
|
||||
#'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
|
||||
#LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
|
||||
#--exec rm $MYSQL_TEST_DIR/var/tmp/data2.tmp
|
||||
#
|
||||
#SELECT @v19, @v20;
|
||||
#SELECT * FROM t2;
|
||||
#
|
||||
#DROP TABLE t1;
|
||||
#DROP TABLE t2;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20)
|
||||
default NULL);
|
||||
|
||||
INSERT INTO t1 VALUES (1,1,'ORANGE');
|
||||
INSERT INTO t1 VALUES (2,2,'APPLE');
|
||||
INSERT INTO t1 VALUES (3,2,'APPLE');
|
||||
INSERT INTO t1 VALUES (4,3,'PEAR');
|
||||
|
||||
SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name =
|
||||
'APPLE';
|
||||
SELECT @v1, @v2;
|
||||
|
||||
SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id,
|
||||
fruit_name HAVING fruit_name = 'APPLE';
|
||||
SELECT @v3, @v4;
|
||||
|
||||
SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
|
||||
fruit_name = 'APPLE';
|
||||
SELECT @v5, @v6, @v7, @v8;
|
||||
|
||||
SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
|
||||
WHERE fruit_name = 'APPLE';
|
||||
SELECT @v5, @v6, @v7, @v8, @v9, @v10;
|
||||
|
||||
SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
|
||||
@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
|
||||
SELECT @v11, @v12, @v13, @v14;
|
||||
|
||||
SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
|
||||
SELECT @v15, @v16;
|
||||
|
||||
SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
|
||||
'APPLE';
|
||||
SELECT @v17, @v18;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
|
||||
default NULL);
|
||||
|
||||
SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
|
||||
'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
|
||||
LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
|
||||
--error 0,1
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/data1.tmp
|
||||
|
||||
SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
|
||||
'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
|
||||
LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/data2.tmp
|
||||
|
||||
SELECT @v19, @v20;
|
||||
SELECT * FROM t2;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
||||
#
|
||||
# Bug #15881: cast problems
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user