Commit 90d62296 authored by unknown's avatar unknown

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

into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50


sql/handler.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.cc:
  Auto merged
parents ed483685 7b1f5425
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*.bin *.bin
*.vcproj.cmake *.vcproj.cmake
cmake_install.cmake cmake_install.cmake
*.cdf
*.core *.core
*.d *.d
*.da *.da
......
...@@ -139,21 +139,47 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR ...@@ -139,21 +139,47 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D _CRT_SECURE_NO_DEPRECATE") ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D _CRT_SECURE_NO_DEPRECATE")
IF(EMBED_MANIFESTS) IF(EMBED_MANIFESTS)
# Search for the Manifest tool. CMake will first search it's defaults # Search for the tools (mt, makecat, signtool) necessary for embedding
# (CMAKE_FRAMEWORK_PATH, CMAKE_APPBUNDLE_PATH, CMAKE_PROGRAM_PATH and # manifests and signing executables with the MySQL AB authenticode cert.
# the system PATH) followed by the listed paths which are the current #
# possible defaults and should be updated when necessary. The custom # CMake will first search it's defaults (CMAKE_FRAMEWORK_PATH,
# manifests are designed to be compatible with all mt versions. # CMAKE_APPBUNDLE_PATH, CMAKE_PROGRAM_PATH and the system PATH) followed
# by the listed paths which are the current possible defaults and should be
# updated when necessary.
#
# The custom manifests are designed to be compatible with all mt versions.
# The MySQL AB Authenticode certificate is available only internally.
# Others should store a single signing certificate in a local cryptographic
# service provider and alter the signtool command as necessary.
FIND_PROGRAM(HAVE_MANIFEST_TOOL NAMES mt FIND_PROGRAM(HAVE_MANIFEST_TOOL NAMES mt
PATHS PATHS
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/VC/bin" "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/VC/bin"
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin" "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin"
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin") "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin")
FIND_PROGRAM(HAVE_CATALOG_TOOL NAMES makecat
PATHS
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin")
FIND_PROGRAM(HAVE_SIGN_TOOL NAMES signtool
PATHS
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin"
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin")
IF(HAVE_MANIFEST_TOOL) IF(HAVE_MANIFEST_TOOL)
MESSAGE(STATUS "Found Mainfest Tool. Embedding custom manifests.") MESSAGE(STATUS "Found Mainfest Tool.")
ELSE(HAVE_MANIFEST_TOOL) ELSE(HAVE_MANIFEST_TOOL)
MESSAGE(FATAL_ERROR "Manifest tool, mt.exe, can't be found.") MESSAGE(FATAL_ERROR "Manifest tool, mt.exe, can't be found.")
ENDIF(HAVE_MANIFEST_TOOL) ENDIF(HAVE_MANIFEST_TOOL)
IF(HAVE_CATALOG_TOOL)
MESSAGE(STATUS "Found Catalog Tool.")
ELSE(HAVE_CATALOG_TOOL)
MESSAGE(FATAL_ERROR "Catalog tool, makecat.exe, can't be found.")
ENDIF(HAVE_CATALOG_TOOL)
IF(HAVE_SIGN_TOOL)
MESSAGE(STATUS "Found Sign Tool. Embedding custom manifests and signing executables.")
ELSE(HAVE_SIGN_TOOL)
MESSAGE(FATAL_ERROR "Sign tool, signtool.exe, can't be found.")
ENDIF(HAVE_SIGN_TOOL)
# Disable automatic manifest generation. # Disable automatic manifest generation.
STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS
${CMAKE_EXE_LINKER_FLAGS}) ${CMAKE_EXE_LINKER_FLAGS})
......
...@@ -20,6 +20,7 @@ AUTOMAKE_OPTIONS = foreign ...@@ -20,6 +20,7 @@ AUTOMAKE_OPTIONS = foreign
# These are built from source in the Docs directory # These are built from source in the Docs directory
EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
README COPYING EXCEPTIONS-CLIENT CMakeLists.txt README COPYING EXCEPTIONS-CLIENT CMakeLists.txt
SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \
@readline_topdir@ sql-common scripts \ @readline_topdir@ sql-common scripts \
@thread_dirs@ pstack \ @thread_dirs@ pstack \
...@@ -157,8 +158,6 @@ test-bt: ...@@ -157,8 +158,6 @@ test-bt:
@PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --suite=funcs_1 @PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --suite=funcs_1
-cd mysql-test ; MTR_BUILD_THREAD=auto \ -cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2 @PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=rowlock --suite=row_lock
-if [ -d mysql-test/suite/nist ] ; then \ -if [ -d mysql-test/suite/nist ] ; then \
cd mysql-test ; MTR_BUILD_THREAD=auto \ cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=NIST+normal --force --suite=nist ; \ @PERL@ ./mysql-test-run.pl --comment=NIST+normal --force --suite=nist ; \
......
...@@ -15,9 +15,7 @@ ...@@ -15,9 +15,7 @@
## Process this file with automake to create Makefile.in ## Process this file with automake to create Makefile.in
EXTRA_DIST= NOTES cacert.pem client-cert.pem client-key.pem \ EXTRA_DIST= NOTES run-client run-server
run-client run-server server-cert.pem \
server-key.pem
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%
...@@ -992,6 +992,21 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res, ...@@ -992,6 +992,21 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
return 0; return 0;
} }
static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
{
char query_buffer[QUERY_LENGTH];
size_t query_length;
query_length= my_snprintf(query_buffer,
sizeof (query_buffer),
"SET SESSION character_set_results = '%s'",
(const char *) cs_name);
return mysql_real_query(mysql, query_buffer, query_length);
}
/* /*
Open a new .sql file to dump the table or view into Open a new .sql file to dump the table or view into
...@@ -1671,7 +1686,10 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1671,7 +1686,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
MYSQL_FIELD *field; MYSQL_FIELD *field;
my_snprintf(buff, sizeof(buff), "show create table %s", result_table); my_snprintf(buff, sizeof(buff), "show create table %s", result_table);
if (mysql_query_with_error_report(mysql, 0, buff))
if (switch_character_set_results(mysql, "binary") ||
mysql_query_with_error_report(mysql, &result, buff) ||
switch_character_set_results(mysql, default_charset))
DBUG_RETURN(0); DBUG_RETURN(0);
if (path) if (path)
...@@ -1702,7 +1720,6 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1702,7 +1720,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
check_io(sql_file); check_io(sql_file);
} }
result= mysql_store_result(mysql);
field= mysql_fetch_field_direct(result, 0); field= mysql_fetch_field_direct(result, 0);
if (strcmp(field->name, "View") == 0) if (strcmp(field->name, "View") == 0)
{ {
...@@ -1794,7 +1811,14 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1794,7 +1811,14 @@ static uint get_table_structure(char *table, char *db, char *table_type,
} }
row= mysql_fetch_row(result); row= mysql_fetch_row(result);
fprintf(sql_file, "%s;\n", row[1]);
fprintf(sql_file,
"SET @saved_cs_client = @@character_set_client;\n"
"SET character_set_client = utf8;\n"
"%s;\n"
"SET character_set_client = @saved_cs_client;\n",
row[1]);
check_io(sql_file); check_io(sql_file);
mysql_free_result(result); mysql_free_result(result);
} }
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c
AHDR = vi.h emacs.h common.h AHDR = vi.h emacs.h common.h
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ # Make sure to include stuff from this directory first, to get right "config.h"
-I$(srcdir)/../.. -I.. INCLUDES = -I. -I$(top_builddir)/include -I$(top_srcdir)/include
noinst_LIBRARIES = libedit.a noinst_LIBRARIES = libedit.a
......
...@@ -127,14 +127,9 @@ AC_DEFUN([MYSQL_SYS_LARGEFILE], ...@@ -127,14 +127,9 @@ AC_DEFUN([MYSQL_SYS_LARGEFILE],
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
ac_cv_sys_largefile_source=1 ;; ac_cv_sys_largefile_source=1 ;;
esac]) esac])
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
ac_cv_sys_large_files, # AIX 4.2 and later -- do nothing, include standards.h instead.
[Large files support on AIX-style hosts.], # this goes for both GNU and IBM C and C++ compilers.
[case "$host_os" in
# AIX 4.2 and later
aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
ac_cv_sys_large_files=1 ;;
esac])
fi fi
]) ])
...@@ -763,7 +763,6 @@ AC_SUBST(CXX_VERSION) ...@@ -763,7 +763,6 @@ AC_SUBST(CXX_VERSION)
]) ])
AC_DEFUN([MYSQL_PROG_AR], [ AC_DEFUN([MYSQL_PROG_AR], [
AC_REQUIRE([MYSQL_CHECK_CXX_VERSION])
case $CXX_VERSION in case $CXX_VERSION in
MIPSpro*) MIPSpro*)
AR=$CXX AR=$CXX
......
...@@ -8,7 +8,7 @@ AC_CANONICAL_SYSTEM ...@@ -8,7 +8,7 @@ AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb # remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.0.48) AM_INIT_AUTOMAKE(mysql, 5.0.48)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
DOT_FRM_VERSION=6 DOT_FRM_VERSION=6
...@@ -2898,6 +2898,12 @@ then ...@@ -2898,6 +2898,12 @@ then
ndb_opt_subdirs="$ndb_opt_subdirs docs" ndb_opt_subdirs="$ndb_opt_subdirs docs"
ndb_bin_am_ldflags="" ndb_bin_am_ldflags=""
fi fi
# building dynamic breaks on AIX. (If you want to try it and get unresolved
# __vec__delete2 and some such, try linking against libhC.)
case "$host_os" in
aix3.* | aix4.0.* | aix4.1.*) ;;
*) ndb_bin_am_ldflags="-static";;
esac
AC_SUBST([ndb_bin_am_ldflags]) AC_SUBST([ndb_bin_am_ldflags])
AC_SUBST([ndb_opt_subdirs]) AC_SUBST([ndb_opt_subdirs])
......
...@@ -184,7 +184,7 @@ void Base64Decoder::Decode() ...@@ -184,7 +184,7 @@ void Base64Decoder::Decode()
{ {
word32 bytes = coded_.size(); word32 bytes = coded_.size();
word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz); word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz);
plainSz = (plainSz * 3 + 3) / 4; plainSz = ((plainSz * 3) / 4) + 3;
decoded_.New(plainSz); decoded_.New(plainSz);
word32 i = 0; word32 i = 0;
......
...@@ -49,8 +49,11 @@ link_sources: ...@@ -49,8 +49,11 @@ link_sources:
@readline_h_ln_cmd@ @readline_h_ln_cmd@
@yassl_h_ln_cmd@ @yassl_h_ln_cmd@
my_config.h: ../config.h # We want both "my_config.h" and "config.h" that are identical, as
$(CP) ../config.h my_config.h # MySQL sources assumes the name "my_config.h", and 3rd party sources
# assumes the name "config.h".
my_config.h: config.h
$(CP) config.h my_config.h
# These files should not be included in distributions since they are # These files should not be included in distributions since they are
# generated by configure from the .h.in files # generated by configure from the .h.in files
......
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
#ifndef _mysql_h #ifndef _mysql_h
#define _mysql_h #define _mysql_h
#ifdef _AIX /* large-file support will break without this */
#include <standards.h>
#endif
#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */ #ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */
#undef WIN #undef WIN
#undef _WIN #undef _WIN
......
...@@ -37,12 +37,7 @@ EXTRA_DIST = $(EXTRA_SCRIPTS) suite ...@@ -37,12 +37,7 @@ EXTRA_DIST = $(EXTRA_SCRIPTS) suite
GENSCRIPTS = mysql-test-run-shell mysql-test-run install_test_db mtr GENSCRIPTS = mysql-test-run-shell mysql-test-run install_test_db mtr
PRESCRIPTS = mysql-test-run.pl mysql-stress-test.pl PRESCRIPTS = mysql-test-run.pl mysql-stress-test.pl
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS) test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
test_DATA = std_data/client-key.pem \ CLEANFILES = $(GENSCRIPTS)
std_data/client-cert.pem \
std_data/cacert.pem \
std_data/server-cert.pem \
std_data/server-key.pem
CLEANFILES = $(GENSCRIPTS) $(test_DATA)
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I.. INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
...@@ -111,17 +106,6 @@ install-data-local: ...@@ -111,17 +106,6 @@ install-data-local:
uninstall-local: uninstall-local:
@RM@ -f -r $(DESTDIR)$(testdir) @RM@ -f -r $(DESTDIR)$(testdir)
std_data/client-key.pem: $(top_srcdir)/SSL/$(@F)
@RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
std_data/client-cert.pem: $(top_srcdir)/SSL/$(@F)
@RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
std_data/cacert.pem: $(top_srcdir)/SSL/$(@F)
@RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
std_data/server-cert.pem: $(top_srcdir)/SSL/$(@F)
@RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
std_data/server-key.pem: $(top_srcdir)/SSL/$(@F)
@RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
# mtr - a shortcut for executing mysql-test-run.pl # mtr - a shortcut for executing mysql-test-run.pl
mtr: mtr:
$(RM) -f mtr $(RM) -f mtr
......
...@@ -1844,6 +1844,43 @@ C3A4C3B6C3BCC39F ...@@ -1844,6 +1844,43 @@ C3A4C3B6C3BCC39F
D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E
drop table federated.t1; drop table federated.t1;
drop table federated.t1; drop table federated.t1;
CREATE TABLE federated.t1 (
categoryId int(11) NOT NULL AUTO_INCREMENT,
domainId varchar(745) NOT NULL DEFAULT '',
categoryName varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (categoryId),
UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName),
KEY idx_category_domainId (domainId)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE federated.t1 (
categoryId int(11) NOT NULL AUTO_INCREMENT,
domainId varchar(745) NOT NULL DEFAULT '',
categoryName varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (categoryId),
UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName),
KEY idx_category_domainId (domainId)
) ENGINE=FEDERATED DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231 300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 250');
insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312 301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 250');
insert into federated.t1 (domainId, categoryName) values ('a', 'b');
select categoryId from federated.t1 order by domainId, categoryName;
categoryId
1
2
3
select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId;
categoryId
3
select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId;
categoryId
3
select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId;
categoryId
1
2
drop table federated.t1;
drop table federated.t1;
create table federated.t1 (a int primary key, b varchar(64)) create table federated.t1 (a int primary key, b varchar(64))
DEFAULT CHARSET=utf8; DEFAULT CHARSET=utf8;
create table federated.t1 (a int primary key, b varchar(64)) create table federated.t1 (a int primary key, b varchar(64))
......
...@@ -840,11 +840,11 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -840,11 +840,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings: Warnings:
Note 1003 select period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname(_latin1'1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)` Note 1003 select period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname(_latin1'1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
SET @TMP=NOW(); SET @TMP='2007-08-01 12:22:49';
CREATE TABLE t1 (d DATETIME); CREATE TABLE t1 (d DATETIME);
INSERT INTO t1 VALUES (NOW()); INSERT INTO t1 VALUES ('2007-08-01 12:22:59');
INSERT INTO t1 VALUES (NOW()); INSERT INTO t1 VALUES ('2007-08-01 12:23:01');
INSERT INTO t1 VALUES (NOW()); INSERT INTO t1 VALUES ('2007-08-01 12:23:20');
SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1); SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1);
count(*) count(*)
3 3
......
...@@ -418,7 +418,7 @@ DROP TABLE t1,t2; ...@@ -418,7 +418,7 @@ DROP TABLE t1,t2;
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
character set utf8 collate utf8_general_ci; character set utf8 collate utf8_general_ci;
Warnings: Warnings:
Warning 1071 Specified key was too long; max key length is 765 bytes Warning 1071 Specified key was too long; max key length is 767 bytes
insert into t1 values('aaa'); insert into t1 values('aaa');
drop table t1; drop table t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB; CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB;
...@@ -739,6 +739,34 @@ drop table if exists t1; ...@@ -739,6 +739,34 @@ drop table if exists t1;
create table t1 (a int) engine=innodb; create table t1 (a int) engine=innodb;
alter table t1 alter a set default 1; alter table t1 alter a set default 1;
drop table t1; drop table t1;
Bug#24918 drop table and lock / inconsistent between
perm and temp tables
Check transactional tables under LOCK TABLES
drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp,
t24918_access;
create table t24918_access (id int);
create table t24918 (id int) engine=myisam;
create temporary table t24918_tmp (id int) engine=myisam;
create table t24918_trans (id int) engine=innodb;
create temporary table t24918_trans_tmp (id int) engine=innodb;
lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write;
drop table t24918;
select * from t24918_access;
ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
drop table t24918_trans;
select * from t24918_access;
ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
drop table t24918_trans_tmp;
select * from t24918_access;
ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
drop table t24918_tmp;
select * from t24918_access;
ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
unlock tables;
drop table t24918_access;
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB; CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2); INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2);
INSERT INTO t1 SELECT a + 8, 2 FROM t1; INSERT INTO t1 SELECT a + 8, 2 FROM t1;
...@@ -1007,4 +1035,16 @@ CALL p1(); ...@@ -1007,4 +1035,16 @@ CALL p1();
CALL p1(); CALL p1();
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1; DROP TABLE t1;
create table t1(a text) engine=innodb default charset=utf8;
insert into t1 values('aaa');
alter table t1 add index(a(1024));
Warnings:
Warning 1071 Specified key was too long; max key length is 767 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text,
KEY `a` (`a`(255))
) ENGINE=InnoDB DEFAULT CHARSET=utf8
drop table t1;
End of 5.0 tests End of 5.0 tests
...@@ -318,4 +318,11 @@ INSERT INTO t1 VALUES ('0123456789'); ...@@ -318,4 +318,11 @@ INSERT INTO t1 VALUES ('0123456789');
flush logs; flush logs;
DROP TABLE t1; DROP TABLE t1;
# Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED # Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED
flush logs;
create table t1(a int);
insert into t1 values(connection_id());
flush logs;
drop table t1;
1
drop table t1;
End of 5.0 tests End of 5.0 tests
...@@ -93,55 +93,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l ...@@ -93,55 +93,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`; USE `test`;
DROP TABLE IF EXISTS `t1`; DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`id` int(8) default NULL, `id` int(8) default NULL,
`name` varchar(32) default NULL `name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */; /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */; /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`; DROP TABLE IF EXISTS `t2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t2` ( CREATE TABLE `t2` (
`id` int(8) default NULL, `id` int(8) default NULL,
`name` varchar(32) default NULL `name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */; /*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */; /*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`; DROP TABLE IF EXISTS `t3`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t3` ( CREATE TABLE `t3` (
`id` int(8) default NULL, `id` int(8) default NULL,
`name` varchar(32) default NULL `name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1; ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */; /*!40000 ALTER TABLE `t3` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */; /*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`; DROP TABLE IF EXISTS `t4`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t4` ( CREATE TABLE `t4` (
`id` int(8) default NULL, `id` int(8) default NULL,
`name` varchar(32) default NULL `name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1; ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */; /*!40000 ALTER TABLE `t4` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */; /*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`; DROP TABLE IF EXISTS `t5`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t5` ( CREATE TABLE `t5` (
`id` int(8) default NULL, `id` int(8) default NULL,
`name` varchar(32) default NULL `name` varchar(32) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */; /*!40000 ALTER TABLE `t5` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */; /*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`; DROP TABLE IF EXISTS `t6`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t6` ( CREATE TABLE `t6` (
`id` int(8) default NULL, `id` int(8) default NULL,
`name` varchar(32) default NULL `name` varchar(32) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */; /*!40000 ALTER TABLE `t6` DISABLE KEYS */;
INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
...@@ -172,55 +190,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l ...@@ -172,55 +190,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`; USE `test`;
DROP TABLE IF EXISTS `t1`; DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`id` int(8) default NULL, `id` int(8) default NULL,
`name` varchar(32) default NULL `name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */; /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */; /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`; DROP TABLE IF EXISTS `t2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t2` ( CREATE TABLE `t2` (
`id` int(8) default NULL, `id` int(8) default NULL,
`name` varchar(32) default NULL `name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */; /*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */; /*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`; DROP TABLE IF EXISTS `t3`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t3` ( CREATE TABLE `t3` (
`id` int(8) default NULL, `id` int(8) default NULL,
`name` varchar(32) default NULL `name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1; ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */; /*!40000 ALTER TABLE `t3` DISABLE KEYS */;
INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */; /*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`; DROP TABLE IF EXISTS `t4`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t4` ( CREATE TABLE `t4` (
`id` int(8) default NULL, `id` int(8) default NULL,
`name` varchar(32) default NULL `name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1; ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */; /*!40000 ALTER TABLE `t4` DISABLE KEYS */;
INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */; /*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`; DROP TABLE IF EXISTS `t5`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t5` ( CREATE TABLE `t5` (
`id` int(8) default NULL, `id` int(8) default NULL,
`name` varchar(32) default NULL `name` varchar(32) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */; /*!40000 ALTER TABLE `t5` DISABLE KEYS */;
INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */; /*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`; DROP TABLE IF EXISTS `t6`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t6` ( CREATE TABLE `t6` (
`id` int(8) default NULL, `id` int(8) default NULL,
`name` varchar(32) default NULL `name` varchar(32) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */; /*!40000 ALTER TABLE `t6` DISABLE KEYS */;
INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
......
This diff is collapsed.
...@@ -77,9 +77,12 @@ INSERT INTO t1 VALUES (1), (2); ...@@ -77,9 +77,12 @@ INSERT INTO t1 VALUES (1), (2);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`; DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`a` int(11) default NULL `a` int(11) default NULL
); );
SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE; LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */; /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
...@@ -108,9 +111,12 @@ UNLOCK TABLES; ...@@ -108,9 +111,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`; DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`a` int(11) default NULL `a` int(11) default NULL
); );
SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE; LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */; /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
...@@ -139,9 +145,12 @@ UNLOCK TABLES; ...@@ -139,9 +145,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`; DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`a` int(11) default NULL `a` int(11) default NULL
); );
SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE; LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */; /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
......
...@@ -1088,6 +1088,26 @@ DROP TABLE t1; ...@@ -1088,6 +1088,26 @@ DROP TABLE t1;
DROP VIEW v1; DROP VIEW v1;
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP FUNCTION f1; DROP FUNCTION f1;
set names koi8r;
DROP DATABASE IF EXISTS mysqltest1;
CREATE DATABASE mysqltest1;
use mysqltest1;
CREATE TABLE t1(1 INT);
---> Dumping mysqltest1 to show_check.mysqltest1.sql
DROP DATABASE mysqltest1;
---> Restoring mysqltest1...
SHOW CREATE TABLE mysqltest1.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`1` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP DATABASE mysqltest1;
use test;
flush status; flush status;
show variables like "log_queries_not_using_indexes"; show variables like "log_queries_not_using_indexes";
Variable_name Value Variable_name Value
......
...@@ -289,4 +289,34 @@ create table t1 select f_bug22427() as i; ...@@ -289,4 +289,34 @@ create table t1 select f_bug22427() as i;
ERROR 42S01: Table 't1' already exists ERROR 42S01: Table 't1' already exists
drop table t1; drop table t1;
drop function f_bug22427; drop function f_bug22427;
#
# Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables
#
DROP table IF EXISTS t1,t2;
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c2 INT);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
BEGIN
UPDATE t2 SET c2= c2 + 1;
END//
# Take a table lock on t1.
# This should pre-lock t2 through the trigger.
LOCK TABLE t1 WRITE;
INSERT INTO t1 VALUES (3);
UNLOCK TABLES;
LOCK TABLE t1 READ;
INSERT INTO t2 values(4);
ERROR HY000: Table 't2' was not locked with LOCK TABLES
UNLOCK TABLES;
SELECT * FROM t1;
c1
1
3
SELECT * FROM t2;
c2
3
DROP TRIGGER t1_ai;
DROP TABLE t1, t2;
End of 5.0 tests End of 5.0 tests
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
-----BEGIN CERTIFICATE-----
MIIJHDCCBQQCAQEwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCU0UxEDAOBgNV
BAgTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMQ0wCwYDVQQLEwRUZXN0MQsw
CQYDVQQDEwJDQTAeFw0wNzA3MTMwNzU2MjVaFw0xMDA0MDgwNzU2MjVaMFoxCzAJ
BgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRkwFwYDVQQKFBBNeVNRTCAgIAog
ICAgIEFCMQ0wCwYDVQQLEwRUZXN0MQ8wDQYDVQQDEwZzZXJ2ZXIwggQiMA0GCSqG
SIb3DQEBAQUAA4IEDwAwggQKAoIEAQDUFlh/3mwov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z+wODmF23CK2XTwoJyPKxvlyGKrIqq3gN
kOmocNu2Qm5bJf+D/hYPm5Ust2wzD52NnvJU536bZ0ZMo1/kaK2idqSAzqo4TkR1
j9U0fdW2rIBDo/qFmBBdJhYVjYLj4qR8CEEoIjshD4Nztf1xRM5C8irE/gJcT5+r
4bPJJ5TjAtHxPiQqZruSprSEUbMsPqBap64ow0SmbNNWSgyaz2ha1rG0p52NBzH4
XM52LBqS9QHPHvB0ooYfBTfPpDM3CePuuNyzjPAw86ncUo38FKXuc2oViJJ6C5I7
v2sKhLK5gu3uPBB2ludDEXSpWBqiraynolOT/o52r+taYp9YY2WU3GrhOiV/A1FV
Nl118xiF6FOFpEeTbhHvy27A8kZEKXgeSs+f4aC0XG9kLVD1CiCbQiqHTDcDS4nV
O1N1eQxhP81X+YKE4Lgufh07REqYVwtCj2lQcMp73WDyfBLKTEFlmHusoqmT5JCH
X0BWNjk5Dn1g5h63/lQb+EjNRILBhDFYhrDRDQtw5p0/7IY3AcNKDUHv+XGn
-----END RSA PRIVATE KEY-----
...@@ -437,19 +437,23 @@ eval SELECT * ...@@ -437,19 +437,23 @@ eval SELECT *
# check also with a 'simple' user # check also with a 'simple' user
CREATE USER user_3212@localhost; CREATE USER user_3212@localhost;
GRANT ALL ON db_datadict.* TO user_3212@localhost; GRANT ALL ON db_datadict.* TO user_3212@localhost;
# OBN: The following line was added following the fix to bug 28181
# where queries to information_schema will fail if exporting to
# a file without having the FILE attribute
GRANT FILE ON *.* TO user_3212@localhost;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (u3212,localhost,user_3212,,db_datadict); connect (u3212,localhost,user_3212,,db_datadict);
--source suite/funcs_1/include/show_connection.inc --source suite/funcs_1/include/show_connection.inc
# no db given --> db_datadict.schema does not exist # no db given --> db_datadict.schema does not exist
--error 1045 --error 1146
eval SELECT * eval SELECT *
INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user.file' INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n' LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5; FROM schemata LIMIT 0, 5;
# FIXME 3.2.1.2: why do we get different error numbers with and without OUTFILE ?
--error 1146 --error 1146
eval SELECT * eval SELECT *
FROM schemata LIMIT 0, 5; FROM schemata LIMIT 0, 5;
...@@ -460,8 +464,6 @@ eval SELECT * ...@@ -460,8 +464,6 @@ eval SELECT *
LINES TERMINATED BY '\n' LINES TERMINATED BY '\n'
FROM information_schema.schemata FROM information_schema.schemata
WHERE schema_name LIKE 'db_%'; WHERE schema_name LIKE 'db_%';
# The above will fail with access error as long as
# BUBG#28181 - a regression introduced in 5.0.42 is not fixed
eval SELECT * eval SELECT *
FROM information_schema.schemata FROM information_schema.schemata
...@@ -469,14 +471,11 @@ eval SELECT * ...@@ -469,14 +471,11 @@ eval SELECT *
USE information_schema; USE information_schema;
# no db given --> db_datadict.schema does not exist
eval SELECT * eval SELECT *
INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user_2.file' INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user_2.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n' LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5; FROM schemata LIMIT 0, 5;
# The above will fail with access error as long as
# BUBG#28181 - a regression introduced in 5.0.42 is not fixed
eval SELECT * eval SELECT *
FROM schemata LIMIT 0, 5; FROM schemata LIMIT 0, 5;
...@@ -487,8 +486,6 @@ eval SELECT * ...@@ -487,8 +486,6 @@ eval SELECT *
LINES TERMINATED BY '\n' LINES TERMINATED BY '\n'
FROM information_schema.schemata FROM information_schema.schemata
WHERE schema_name LIKE 'db_%'; WHERE schema_name LIKE 'db_%';
# The above will fail with access error as long as
# BUBG#28181 - a regression introduced in 5.0.42 is not fixed
eval SELECT * eval SELECT *
FROM information_schema.schemata FROM information_schema.schemata
......
...@@ -4859,6 +4859,7 @@ INTO OUTFILE '../tmp/out.innodb.db.file' ...@@ -4859,6 +4859,7 @@ INTO OUTFILE '../tmp/out.innodb.db.file'
WHERE schema_name LIKE 'db_%'; WHERE schema_name LIKE 'db_%';
CREATE USER user_3212@localhost; CREATE USER user_3212@localhost;
GRANT ALL ON db_datadict.* TO user_3212@localhost; GRANT ALL ON db_datadict.* TO user_3212@localhost;
GRANT FILE ON *.* TO user_3212@localhost;
connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK); connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK);
user_3212@localhost db_datadict user_3212@localhost db_datadict
...@@ -4867,7 +4868,7 @@ INTO OUTFILE '../tmp/out.innodb.user.file' ...@@ -4867,7 +4868,7 @@ INTO OUTFILE '../tmp/out.innodb.user.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n' LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5; FROM schemata LIMIT 0, 5;
ERROR 28000: Access denied for user 'user_3212'@'localhost' (using password: NO) ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
SELECT * SELECT *
FROM schemata LIMIT 0, 5; FROM schemata LIMIT 0, 5;
ERROR 42S02: Table 'db_datadict.schemata' doesn't exist ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
......
...@@ -237,7 +237,7 @@ create table t1 (f1 integer) engine = innodb; ...@@ -237,7 +237,7 @@ create table t1 (f1 integer) engine = innodb;
use test; use test;
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5; for each row set @ret_trg6_2 = 5;
ERROR HY000: Trigger in wrong schema ERROR 42S02: Table 'trig_db.tb3' doesn't exist
use trig_db; use trig_db;
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
for each row set @ret_trg6_3 = 18; for each row set @ret_trg6_3 = 18;
......
...@@ -484,9 +484,8 @@ BEGIN ...@@ -484,9 +484,8 @@ BEGIN
WHILE @counter1 < new.f136 WHILE @counter1 < new.f136
SET @counter1 = @counter1 + 1; SET @counter1 = @counter1 + 1;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHILE @counter1 < new.f136 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @counter1 = @counter1 + 1;
SET @counter1 = @counter1 + 1; END' at line 4
END' at line 3
delete from tb3 where f122='Test 3.5.8.5-while'; delete from tb3 where f122='Test 3.5.8.5-while';
drop trigger trg7; drop trigger trg7;
......
...@@ -194,7 +194,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 ...@@ -194,7 +194,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL
where f122='Test 3.5.9.4'; where f122='Test 3.5.9.4';
Warnings: Warnings:
Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'f136' at row 11 Warning 1048 Column 'f136' cannot be null
select f118, f121, f122, f136, f151, f163 from tb3 select f118, f121, f122, f136, f151, f163 from tb3
where f122 like 'Test 3.5.9.4-trig'; where f122 like 'Test 3.5.9.4-trig';
f118 f121 f122 f136 f151 f163 f118 f121 f122 f136 f151 f163
......
...@@ -10202,7 +10202,8 @@ SHOW FIELDS FROM v1; ...@@ -10202,7 +10202,8 @@ SHOW FIELDS FROM v1;
ERROR 42S02: Table 'test.v1' doesn't exist ERROR 42S02: Table 'test.v1' doesn't exist
CHECK TABLE v1; CHECK TABLE v1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.v1 check error Table 'test.v1' doesn't exist test.v1 check Error Table 'test.v1' doesn't exist
test.v1 check error Corrupt
DESCRIBE v1; DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1; EXPLAIN SELECT * FROM v1;
......
...@@ -4842,6 +4842,7 @@ INTO OUTFILE '../tmp/out.memory.db.file' ...@@ -4842,6 +4842,7 @@ INTO OUTFILE '../tmp/out.memory.db.file'
WHERE schema_name LIKE 'db_%'; WHERE schema_name LIKE 'db_%';
CREATE USER user_3212@localhost; CREATE USER user_3212@localhost;
GRANT ALL ON db_datadict.* TO user_3212@localhost; GRANT ALL ON db_datadict.* TO user_3212@localhost;
GRANT FILE ON *.* TO user_3212@localhost;
connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK); connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK);
user_3212@localhost db_datadict user_3212@localhost db_datadict
...@@ -4850,7 +4851,7 @@ INTO OUTFILE '../tmp/out.memory.user.file' ...@@ -4850,7 +4851,7 @@ INTO OUTFILE '../tmp/out.memory.user.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n' LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5; FROM schemata LIMIT 0, 5;
ERROR 28000: Access denied for user 'user_3212'@'localhost' (using password: NO) ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
SELECT * SELECT *
FROM schemata LIMIT 0, 5; FROM schemata LIMIT 0, 5;
ERROR 42S02: Table 'db_datadict.schemata' doesn't exist ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
......
...@@ -233,7 +233,7 @@ create table t1 (f1 integer) engine = memory; ...@@ -233,7 +233,7 @@ create table t1 (f1 integer) engine = memory;
use test; use test;
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5; for each row set @ret_trg6_2 = 5;
ERROR HY000: Trigger in wrong schema ERROR 42S02: Table 'trig_db.tb3' doesn't exist
use trig_db; use trig_db;
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
for each row set @ret_trg6_3 = 18; for each row set @ret_trg6_3 = 18;
......
...@@ -480,9 +480,8 @@ BEGIN ...@@ -480,9 +480,8 @@ BEGIN
WHILE @counter1 < new.f136 WHILE @counter1 < new.f136
SET @counter1 = @counter1 + 1; SET @counter1 = @counter1 + 1;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHILE @counter1 < new.f136 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @counter1 = @counter1 + 1;
SET @counter1 = @counter1 + 1; END' at line 4
END' at line 3
delete from tb3 where f122='Test 3.5.8.5-while'; delete from tb3 where f122='Test 3.5.8.5-while';
drop trigger trg7; drop trigger trg7;
......
...@@ -190,7 +190,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 ...@@ -190,7 +190,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL
where f122='Test 3.5.9.4'; where f122='Test 3.5.9.4';
Warnings: Warnings:
Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'f136' at row 11 Warning 1048 Column 'f136' cannot be null
select f118, f121, f122, f136, f151, f163 from tb3 select f118, f121, f122, f136, f151, f163 from tb3
where f122 like 'Test 3.5.9.4-trig'; where f122 like 'Test 3.5.9.4-trig';
f118 f121 f122 f136 f151 f163 f118 f121 f122 f136 f151 f163
......
...@@ -10207,7 +10207,8 @@ SHOW FIELDS FROM v1; ...@@ -10207,7 +10207,8 @@ SHOW FIELDS FROM v1;
ERROR 42S02: Table 'test.v1' doesn't exist ERROR 42S02: Table 'test.v1' doesn't exist
CHECK TABLE v1; CHECK TABLE v1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.v1 check error Table 'test.v1' doesn't exist test.v1 check Error Table 'test.v1' doesn't exist
test.v1 check error Corrupt
DESCRIBE v1; DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1; EXPLAIN SELECT * FROM v1;
......
...@@ -4912,6 +4912,7 @@ INTO OUTFILE '../tmp/out.myisam.db.file' ...@@ -4912,6 +4912,7 @@ INTO OUTFILE '../tmp/out.myisam.db.file'
WHERE schema_name LIKE 'db_%'; WHERE schema_name LIKE 'db_%';
CREATE USER user_3212@localhost; CREATE USER user_3212@localhost;
GRANT ALL ON db_datadict.* TO user_3212@localhost; GRANT ALL ON db_datadict.* TO user_3212@localhost;
GRANT FILE ON *.* TO user_3212@localhost;
connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK); connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK);
user_3212@localhost db_datadict user_3212@localhost db_datadict
...@@ -4920,7 +4921,7 @@ INTO OUTFILE '../tmp/out.myisam.user.file' ...@@ -4920,7 +4921,7 @@ INTO OUTFILE '../tmp/out.myisam.user.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n' LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5; FROM schemata LIMIT 0, 5;
ERROR 28000: Access denied for user 'user_3212'@'localhost' (using password: NO) ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
SELECT * SELECT *
FROM schemata LIMIT 0, 5; FROM schemata LIMIT 0, 5;
ERROR 42S02: Table 'db_datadict.schemata' doesn't exist ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
......
...@@ -237,7 +237,7 @@ create table t1 (f1 integer) engine = myisam; ...@@ -237,7 +237,7 @@ create table t1 (f1 integer) engine = myisam;
use test; use test;
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5; for each row set @ret_trg6_2 = 5;
ERROR HY000: Trigger in wrong schema ERROR 42S02: Table 'trig_db.tb3' doesn't exist
use trig_db; use trig_db;
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
for each row set @ret_trg6_3 = 18; for each row set @ret_trg6_3 = 18;
......
...@@ -484,9 +484,8 @@ BEGIN ...@@ -484,9 +484,8 @@ BEGIN
WHILE @counter1 < new.f136 WHILE @counter1 < new.f136
SET @counter1 = @counter1 + 1; SET @counter1 = @counter1 + 1;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHILE @counter1 < new.f136 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @counter1 = @counter1 + 1;
SET @counter1 = @counter1 + 1; END' at line 4
END' at line 3
delete from tb3 where f122='Test 3.5.8.5-while'; delete from tb3 where f122='Test 3.5.8.5-while';
drop trigger trg7; drop trigger trg7;
......
...@@ -194,7 +194,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 ...@@ -194,7 +194,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL
where f122='Test 3.5.9.4'; where f122='Test 3.5.9.4';
Warnings: Warnings:
Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'f136' at row 11 Warning 1048 Column 'f136' cannot be null
select f118, f121, f122, f136, f151, f163 from tb3 select f118, f121, f122, f136, f151, f163 from tb3
where f122 like 'Test 3.5.9.4-trig'; where f122 like 'Test 3.5.9.4-trig';
f118 f121 f122 f136 f151 f163 f118 f121 f122 f136 f151 f163
......
...@@ -265,7 +265,7 @@ let $message= Testcase 3.5.1.8:; ...@@ -265,7 +265,7 @@ let $message= Testcase 3.5.1.8:;
# Can't create a trigger in a different database # Can't create a trigger in a different database
use test; use test;
--error 1435 --error 1146
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5; for each row set @ret_trg6_2 = 5;
......
...@@ -609,7 +609,8 @@ let $col_type= my_year; ...@@ -609,7 +609,8 @@ let $col_type= my_year;
# 1.1.6. CAST --> DECIMAL # 1.1.6. CAST --> DECIMAL
let $target_type= DECIMAL; # Set the following to (37,2) since the default was changed to (10,0) - OBN
let $target_type= DECIMAL(37,2);
# #
let $col_type= my_char_30; let $col_type= my_char_30;
--source suite/funcs_1/views/fv_cast.inc --source suite/funcs_1/views/fv_cast.inc
......
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
SET autocommit=0;
# Create additional connections used through test
CONNECT (root1, localhost, root,,);
SET autocommit=0;
--echo connection default;
CONNECTION default;
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
INSERT INTO t1 VALUES (1,123,1,123);
INSERT INTO t1 VALUES (2,124,2,124);
INSERT INTO t1 VALUES (3,125,3,125);
INSERT INTO t1 VALUES (4,126,4,126);
eval $indext1;
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
INSERT INTO t2 VALUES (1,123,1,123);
INSERT INTO t2 VALUES (2,124,2,124);
INSERT INTO t2 VALUES (3,125,3,125);
INSERT INTO t2 VALUES (4,126,4,126);
eval $indext2;
COMMIT;
SELECT @@global.tx_isolation;
# Both transaction are able to update the tables
eval EXPLAIN $select;
eval $select;
--echo connection root1;
CONNECTION root1;
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
DELETE FROM t1 WHERE t1.i=226;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
DELETE FROM t1 WHERE t1.i=224;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
COMMIT;
--echo connection root1;
CONNECTION root1;
ROLLBACK;
--echo connection default;
CONNECTION default;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
DISCONNECT root1;
--echo connection default;
CONNECTION default;
DROP TABLE t1, t2;
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v1;
--enable_warnings
SET autocommit=0;
# Create additional connections used through test
CONNECT (root1, localhost, root,,);
SET autocommit=0;
--echo connection default;
CONNECTION default;
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
eval $indext1;
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
eval $indext2;
DELIMITER |;
CREATE PROCEDURE fill_t1 (IN upb int)
BEGIN
DECLARE cnt int DEFAULT 0;
WHILE cnt < upb DO
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
SET cnt= cnt+1;
END WHILE;
END;
|
CREATE FUNCTION half_t1() RETURNS int
BEGIN
DECLARE res int DEFAULT 0;
SELECT count(*)/2 INTO res FROM t1;
RETURN res;
END;
|
CREATE PROCEDURE fill_t2 (IN upb int)
BEGIN
DECLARE cnt int DEFAULT 0;
WHILE cnt < upb DO
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
SET cnt= cnt+1;
END WHILE;
END;
|
CREATE FUNCTION half_t2() RETURNS int
BEGIN
DECLARE res int DEFAULT 0;
SELECT count(*)/2 INTO res FROM t2;
RETURN res;
END;
|
DELIMITER ;|
CALL fill_t1 (10);
CALL fill_t2 (10);
COMMIT;
SELECT @@global.tx_isolation;
# With the two separate selects (without join) the differs from
# that select with join.
# Both transaction are able to update the tables
eval EXPLAIN $select;
eval $select;
--echo connection root1;
CONNECTION root1;
SELECT k from t1 WHERE k < half_t1();
SELECT k from t1 WHERE k >= half_t1();
UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
COMMIT;
--echo connection root1;
CONNECTION root1;
ROLLBACK;
--echo connection default;
CONNECTION default;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
DISCONNECT root1;
--echo connection default;
CONNECTION default;
DROP VIEW IF EXISTS v1;
DROP TABLE t1, t2;
#DROP VIEW v1;
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v1;
--enable_warnings
SET autocommit=0;
# Create additional connections used through test
CONNECT (root1, localhost, root,,);
SET autocommit=0;
--echo connection default;
CONNECTION default;
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
eval $indext1;
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
eval $indext2;
DELIMITER |;
CREATE PROCEDURE fill_t1 (IN upb int)
BEGIN
DECLARE cnt int DEFAULT 0;
WHILE cnt < upb DO
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
SET cnt= cnt+1;
END WHILE;
END;
|
CREATE FUNCTION half_t1() RETURNS int
BEGIN
DECLARE res int DEFAULT 0;
SELECT MOD(k,2) INTO res FROM t1;
RETURN res;
END;
|
CREATE PROCEDURE fill_t2 (IN upb int)
BEGIN
DECLARE cnt int DEFAULT 0;
WHILE cnt < upb DO
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
SET cnt= cnt+1;
END WHILE;
END;
|
CREATE FUNCTION half_t2() RETURNS int
BEGIN
DECLARE res int DEFAULT 0;
SELECT MOD(k,2) INTO res FROM t2;
RETURN res;
END;
|
DELIMITER ;|
eval CALL fill_t1 ($nbrows);
eval CALL fill_t2 ($nbrows);
COMMIT;
SELECT @@global.tx_isolation;
# With the two separate selects (without join) the differs from
# that select with join.
# Both transaction are able to update the tables
eval EXPLAIN $select;
eval $select;
--echo connection root1;
CONNECTION root1;
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
COMMIT;
--echo connection root1;
CONNECTION root1;
ROLLBACK;
--echo connection default;
CONNECTION default;
SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
DISCONNECT root1;
--echo connection default;
CONNECTION default;
DROP TABLE t1, t2;
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v1;
--enable_warnings
SET autocommit=0;
# Create additional connections used through test
CONNECT (root1, localhost, root,,);
SET autocommit=0;
--echo connection default;
CONNECTION default;
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
eval $indext1;
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
eval $indext2;
DELIMITER |;
CREATE PROCEDURE fill_t1 (IN upb int)
BEGIN
DECLARE cnt int DEFAULT 0;
WHILE cnt < upb DO
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
SET cnt= cnt+1;
END WHILE;
END;
|
CREATE FUNCTION half_t1() RETURNS int
BEGIN
DECLARE res int DEFAULT 0;
SELECT MOD(k,2) INTO res FROM t1;
RETURN res;
END;
|
CREATE PROCEDURE fill_t2 (IN upb int)
BEGIN
DECLARE cnt int DEFAULT 0;
WHILE cnt < upb DO
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
SET cnt= cnt+1;
END WHILE;
END;
|
CREATE FUNCTION half_t2() RETURNS int
BEGIN
DECLARE res int DEFAULT 0;
SELECT MOD(k,2) INTO res FROM t2;
RETURN res;
END;
|
DELIMITER ;|
eval CALL fill_t1 ($nbrows);
eval CALL fill_t2 ($nbrows);
COMMIT;
SELECT @@global.tx_isolation;
# With the two separate selects (without join) the differs from
# that select with join.
# Both transaction are able to update the tables
eval EXPLAIN $select;
eval $select;
--echo connection root1;
CONNECTION root1;
#SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k FOR UPDATE;
DELETE FROM t1 WHERE t1.k % 2 = 1;
SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
COMMIT;
--echo connection root1;
CONNECTION root1;
ROLLBACK;
--echo connection default;
CONNECTION default;
SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
DISCONNECT root1;
--echo connection default;
CONNECTION default;
DROP TABLE t1, t2;
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v1;
--enable_warnings
SET autocommit=0;
# Create additional connections used through test
CONNECT (root1, localhost, root,,);
SET autocommit=0;
--echo connection default;
CONNECTION default;
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
INSERT INTO t1 VALUES (1,123,1,123);
INSERT INTO t1 VALUES (2,124,2,124);
INSERT INTO t1 VALUES (3,125,3,125);
INSERT INTO t1 VALUES (4,126,4,126);
eval $indext1;
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
INSERT INTO t2 VALUES (1,123,1,123);
INSERT INTO t2 VALUES (2,124,2,124);
INSERT INTO t2 VALUES (3,125,3,125);
INSERT INTO t2 VALUES (4,126,4,126);
eval $indext2;
DELIMITER |;
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
FOR EACH ROW BEGIN
UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
END;
|
DELIMITER ;|
COMMIT;
SELECT @@global.tx_isolation;
# With the two separate selects (without join) the differs from
# that select with join.
# Both transaction are able to update the tables
eval EXPLAIN $select;
eval $select;
--echo connection root1;
CONNECTION root1;
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
UPDATE t2 SET t2.i=223 WHERE t2.i=123;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
UPDATE t2 SET t2.i=226 WHERE t2.i=126;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
UPDATE t2 SET t2.i=224 WHERE t2.i=124;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
DELETE FROM t1 WHERE t1.i=226;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
DELETE FROM t1 WHERE t1.i=224;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
COMMIT;
--echo connection root1;
CONNECTION root1;
ROLLBACK;
--echo connection default;
CONNECTION default;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
DISCONNECT root1;
--echo connection default;
CONNECTION default;
DROP TABLE t1, t2;
#DROP VIEW v1;
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v1;
--enable_warnings
SET autocommit=0;
# Create additional connections used through test
CONNECT (root1, localhost, root,,);
SET autocommit=0;
--echo connection default;
CONNECTION default;
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
INSERT INTO t1 VALUES (1,123,1,123);
INSERT INTO t1 VALUES (2,124,2,124);
INSERT INTO t1 VALUES (3,125,3,125);
INSERT INTO t1 VALUES (4,126,4,126);
eval $indext1;
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
INSERT INTO t2 VALUES (1,123,1,123);
INSERT INTO t2 VALUES (2,124,2,124);
INSERT INTO t2 VALUES (3,125,3,125);
INSERT INTO t2 VALUES (4,126,4,126);
eval $indext2;
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
COMMIT;
SELECT @@global.tx_isolation;
# With the two separate selects (without join) the differs from
# that select with join.
# Both transaction are able to update the tables
eval EXPLAIN $select;
eval $select;
--echo connection root1;
CONNECTION root1;
UPDATE v1 SET i=325 where i=125;
SELECT * FROM v1 ORDER BY i,l;
SELECT * FROM t1 ORDER BY t1.k;
--echo connection default;
CONNECTION default;
UPDATE v1 SET i=323 where i=123;
SELECT * FROM v1 ORDER BY i,l;
SELECT * FROM t1 ORDER BY t1.k;
--echo connection root1;
CONNECTION root1;
UPDATE v1 SET i=326 where i=126;
SELECT * FROM v1 ORDER BY i,l;
SELECT * FROM t1 ORDER BY t1.k;
--echo connection default;
CONNECTION default;
UPDATE v1 SET i=324 where i=124;
SELECT * FROM v1 ORDER BY i,l;
SELECT * FROM t1 ORDER BY t1.k;
--echo connection root1;
CONNECTION root1;
DELETE FROM t1 WHERE t1.i=226;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
DELETE FROM t1 WHERE t1.i=224;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
COMMIT;
--echo connection root1;
CONNECTION root1;
ROLLBACK;
--echo connection default;
CONNECTION default;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
DISCONNECT root1;
--echo connection default;
CONNECTION default;
DROP VIEW IF EXISTS v1;
DROP TABLE t1, t2;
#DROP VIEW v1;
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v1;
--enable_warnings
SET autocommit=0;
# Create additional connections used through test
CONNECT (root1, localhost, root,,);
SET autocommit=0;
--echo connection default;
CONNECTION default;
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
INSERT INTO t1 VALUES (1,123,1,123);
INSERT INTO t1 VALUES (2,124,2,124);
INSERT INTO t1 VALUES (3,125,3,125);
INSERT INTO t1 VALUES (4,126,4,126);
eval $indext1;
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
INSERT INTO t2 VALUES (1,123,1,123);
INSERT INTO t2 VALUES (2,124,2,124);
INSERT INTO t2 VALUES (3,125,3,125);
INSERT INTO t2 VALUES (4,126,4,126);
eval $indext2;
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
COMMIT;
SELECT @@global.tx_isolation;
# With the two separate selects (without join) the differs from
# that select with join.
# Both transaction are able to update the tables
eval EXPLAIN $select;
eval $select;
--echo connection root1;
CONNECTION root1;
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
#UPDATE v1 SET i=325 where i=125;
#SELECT * FROM v1 ORDER BY i,l;
#SELECT * FROM t1 ORDER BY t1.k;
--echo connection default;
CONNECTION default;
UPDATE v1 SET i=323 where i=123;
SELECT * FROM v1 ORDER BY i,l;
SELECT * FROM t1 ORDER BY t1.k;
--echo connection root1;
CONNECTION root1;
UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
UPDATE v1 SET i=324 where i=124;
SELECT * FROM v1 ORDER BY i,l;
SELECT * FROM t1 ORDER BY t1.k;
--echo connection root1;
CONNECTION root1;
DELETE FROM t1 WHERE t1.i=226;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
DELETE FROM t1 WHERE t1.i=224;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
COMMIT;
--echo connection root1;
CONNECTION root1;
ROLLBACK;
--echo connection default;
CONNECTION default;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
DISCONNECT root1;
--echo connection default;
CONNECTION default;
DROP VIEW IF EXISTS v1;
DROP TABLE t1, t2;
#DROP VIEW v1;
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v1;
DROP PROCEDURE IF EXISTS stp_t;
--enable_warnings
SET autocommit=0;
# Create additional connections used through test
CONNECT (root1, localhost, root,,);
SET autocommit=0;
CONNECT (root2, localhost, root,,);
SET autocommit=0;
--echo connection default;
CONNECTION default;
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
INSERT INTO t1 VALUES (1,123,1,123);
INSERT INTO t1 VALUES (2,124,2,124);
INSERT INTO t1 VALUES (3,125,3,125);
INSERT INTO t1 VALUES (4,126,4,126);
INSERT INTO t1 VALUES (5,127,5,127);
INSERT INTO t1 VALUES (6,128,6,128);
eval $indext1;
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
INSERT INTO t2 VALUES (1,123,1,123);
INSERT INTO t2 VALUES (2,124,2,124);
INSERT INTO t2 VALUES (3,125,3,125);
INSERT INTO t2 VALUES (4,126,4,126);
INSERT INTO t2 VALUES (5,127,5,127);
INSERT INTO t2 VALUES (6,128,6,128);
eval $indext2;
CREATE VIEW v1 AS SELECT t1.i from t1;
DELIMITER |;
CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
BEGIN
UPDATE t2 SET i = p2 WHERE i = p1;
UPDATE v1 SET i = p2 WHERE i = p1;
SELECT * FROM v1 ORDER BY i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
END;
|
DELIMITER ;|
COMMIT;
SELECT @@global.tx_isolation;
eval EXPLAIN $select;
eval $select;
--echo connection root1;
CONNECTION root1;
CALL stp_t (125, 225);
--echo connection root2;
CONNECTION root2;
CALL stp_t (127, 227);
--echo connection default;
CONNECTION default;
CALL stp_t (123, 223);
--echo connection root1;
CONNECTION root1;
CALL stp_t (126, 226);
--echo connection root2;
CONNECTION root2;
CALL stp_t (128, 228);
--echo connection default;
CONNECTION default;
CALL stp_t (124, 224);
--echo connection root1;
CONNECTION root1;
DELETE FROM t1 WHERE t1.i=226;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root2;
CONNECTION root2;
DELETE FROM t1 WHERE t1.i=228;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
DELETE FROM t1 WHERE t1.i=224;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
COMMIT;
--echo connection root1;
CONNECTION root1;
ROLLBACK;
--echo connection root1;
CONNECTION root1;
COMMIT;
--echo connection default;
CONNECTION default;
SELECT * FROM v1 ORDER BY i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
SELECT * FROM v1 ORDER BY i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
DISCONNECT root1;
--echo connection root2;
CONNECTION root2;
SELECT * FROM v1 ORDER BY i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
DISCONNECT root2;
--echo connection default;
CONNECTION default;
--disable_warnings
DROP VIEW v1;
DROP PROCEDURE stp_t;
DROP TABLE t1, t2;
--enable_warnings
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v1;
--enable_warnings
SET autocommit=0;
# Create additional connections used through test
CONNECT (root1, localhost, root,,);
SET autocommit=0;
--echo connection default;
CONNECTION default;
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
INSERT INTO t1 VALUES (1,123,1,123);
INSERT INTO t1 VALUES (2,124,2,124);
INSERT INTO t1 VALUES (3,125,3,125);
INSERT INTO t1 VALUES (4,126,4,126);
eval $indext1;
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
INSERT INTO t2 VALUES (1,123,1,123);
INSERT INTO t2 VALUES (2,124,2,124);
INSERT INTO t2 VALUES (3,125,3,125);
INSERT INTO t2 VALUES (4,126,4,126);
eval $indext2;
CREATE VIEW v1 AS SELECT t1.i from t1;
DELIMITER |;
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
FOR EACH ROW BEGIN
UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
END;
|
DELIMITER ;|
COMMIT;
SELECT @@global.tx_isolation;
eval EXPLAIN $select;
eval $select;
--echo connection root1;
CONNECTION root1;
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
SELECT * FROM v1 ORDER BY i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
UPDATE t2 SET t2.i=223 WHERE t2.i=123;
SELECT * FROM v1 ORDER BY i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
UPDATE t2 SET t2.i=226 WHERE t2.i=126;
SELECT * FROM v1 ORDER BY i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
UPDATE t2 SET t2.i=224 WHERE t2.i=124;
SELECT * FROM v1 ORDER BY i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
DELETE FROM t1 WHERE t1.i=226;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection default;
CONNECTION default;
DELETE FROM t1 WHERE t1.i=224;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
COMMIT;
--echo connection root1;
CONNECTION root1;
ROLLBACK;
--echo connection default;
CONNECTION default;
SELECT * FROM v1 ORDER BY i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
--echo connection root1;
CONNECTION root1;
SELECT * FROM v1 ORDER BY i;
SELECT * FROM t1 ORDER BY t1.k;
SELECT * FROM t2 ORDER BY t2.k;
DISCONNECT root1;
--echo connection default;
CONNECTION default;
DROP TABLE t1, t2;
DROP VIEW v1;
SELECT @@global.innodb_table_locks into @table_locks;
SET @@global.innodb_table_locks= OFF;
DROP TABLE IF EXISTS t1, t2;
SET autocommit=0;
SET autocommit=0;
connection default;
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,123,1,123);
INSERT INTO t1 VALUES (2,124,2,124);
INSERT INTO t1 VALUES (3,125,3,125);
INSERT INTO t1 VALUES (4,126,4,126);
CREATE INDEX ixi ON t1 (i);
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,123,1,123);
INSERT INTO t2 VALUES (2,124,2,124);
INSERT INTO t2 VALUES (3,125,3,125);
INSERT INTO t2 VALUES (4,126,4,126);
CREATE INDEX ixi ON t2 (i);
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
i i
123 123
124 124
connection root1;
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 126 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 126 4 126
connection default;
UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 223 1 123
2 124 2 124
3 125 3 125
4 126 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 223 1 123
2 124 2 124
3 125 3 125
4 126 4 126
connection root1;
UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 226 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 226 4 126
connection default;
UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 223 1 123
2 224 2 124
3 125 3 125
4 126 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 223 1 123
2 224 2 124
3 125 3 125
4 126 4 126
connection root1;
DELETE FROM t1 WHERE t1.i=226;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 226 4 126
connection default;
DELETE FROM t1 WHERE t1.i=224;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 223 1 123
3 125 3 125
4 126 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 223 1 123
2 224 2 124
3 125 3 125
4 126 4 126
COMMIT;
connection root1;
ROLLBACK;
connection default;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 223 1 123
3 125 3 125
4 126 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 223 1 123
2 224 2 124
3 125 3 125
4 126 4 126
connection root1;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 223 1 123
3 125 3 125
4 126 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 223 1 123
2 224 2 124
3 125 3 125
4 126 4 126
connection default;
DROP TABLE t1, t2;
SET @@global.innodb_table_locks= @table_locks;
SELECT @@global.innodb_table_locks into @table_locks;
SET @@global.innodb_table_locks= OFF;
DROP TABLE IF EXISTS t1, t2;
SET autocommit=0;
SET autocommit=0;
connection default;
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,123,1,123);
INSERT INTO t1 VALUES (2,124,2,124);
INSERT INTO t1 VALUES (3,125,3,125);
INSERT INTO t1 VALUES (4,126,4,126);
#CREATE INDEX ixi ON t1 (i);
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,123,1,123);
INSERT INTO t2 VALUES (2,124,2,124);
INSERT INTO t2 VALUES (3,125,3,125);
INSERT INTO t2 VALUES (4,126,4,126);
#CREATE INDEX ixi ON t2 (i);
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
i i
123 123
124 124
connection root1;
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
SELECT @@global.innodb_table_locks into @table_locks;
SET @@global.innodb_table_locks= OFF;
DROP TABLE IF EXISTS t1, t2;
SET autocommit=0;
SET autocommit=0;
connection default;
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,123,1,123);
INSERT INTO t1 VALUES (2,124,2,124);
INSERT INTO t1 VALUES (3,125,3,125);
INSERT INTO t1 VALUES (4,126,4,126);
#CREATE INDEX ixi ON t1 (i);
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,123,1,123);
INSERT INTO t2 VALUES (2,124,2,124);
INSERT INTO t2 VALUES (3,125,3,125);
INSERT INTO t2 VALUES (4,126,4,126);
#CREATE INDEX ixi ON t2 (i);
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
i i
123 123
124 124
connection root1;
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
SELECT @@global.innodb_table_locks into @table_locks;
SET @@global.innodb_table_locks= OFF;
DROP TABLE IF EXISTS t1, t2;
SET autocommit=0;
SET autocommit=0;
connection default;
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,123,1,123);
INSERT INTO t1 VALUES (2,124,2,124);
INSERT INTO t1 VALUES (3,125,3,125);
INSERT INTO t1 VALUES (4,126,4,126);
CREATE INDEX ixi ON t1 (i);
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,123,1,123);
INSERT INTO t2 VALUES (2,124,2,124);
INSERT INTO t2 VALUES (3,125,3,125);
INSERT INTO t2 VALUES (4,126,4,126);
CREATE INDEX ixi ON t2 (i);
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
i i
123 123
124 124
connection root1;
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 126 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 126 4 126
connection default;
UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 223 1 123
2 124 2 124
3 125 3 125
4 126 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 223 1 123
2 124 2 124
3 125 3 125
4 126 4 126
connection root1;
UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 226 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 226 4 126
connection default;
UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 223 1 123
2 224 2 124
3 125 3 125
4 126 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 223 1 123
2 224 2 124
3 125 3 125
4 126 4 126
connection root1;
DELETE FROM t1 WHERE t1.i=226;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 226 4 126
connection default;
DELETE FROM t1 WHERE t1.i=224;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 223 1 123
3 125 3 125
4 126 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 223 1 123
2 224 2 124
3 125 3 125
4 126 4 126
COMMIT;
connection root1;
ROLLBACK;
connection default;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 223 1 123
3 125 3 125
4 126 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 223 1 123
2 224 2 124
3 125 3 125
4 126 4 126
connection root1;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 223 1 123
3 125 3 125
4 126 4 126
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 223 1 123
2 224 2 124
3 125 3 125
4 126 4 126
connection default;
DROP TABLE t1, t2;
SET @@global.innodb_table_locks= @table_locks;
SELECT @@global.innodb_table_locks into @table_locks;
SET @@global.innodb_table_locks= OFF;
DROP TABLE IF EXISTS t1, t2;
SET autocommit=0;
SET autocommit=0;
connection default;
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,123,1,123);
INSERT INTO t1 VALUES (2,124,2,124);
INSERT INTO t1 VALUES (3,125,3,125);
INSERT INTO t1 VALUES (4,126,4,126);
CREATE INDEX ixi ON t1 (i);
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,123,1,123);
INSERT INTO t2 VALUES (2,124,2,124);
INSERT INTO t2 VALUES (3,125,3,125);
INSERT INTO t2 VALUES (4,126,4,126);
CREATE INDEX ixi ON t2 (i);
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
i i
123 123
124 124
connection root1;
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
SELECT @@global.innodb_table_locks into @table_locks;
SET @@global.innodb_table_locks= OFF;
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v1;
SET autocommit=0;
SET autocommit=0;
connection default;
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
CREATE INDEX ixi ON t1 (i);
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
CREATE INDEX ixi ON t2 (i);
CREATE PROCEDURE fill_t1 (IN upb int)
BEGIN
DECLARE cnt int DEFAULT 0;
WHILE cnt < upb DO
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
SET cnt= cnt+1;
END WHILE;
END;
|
CREATE FUNCTION half_t1() RETURNS int
BEGIN
DECLARE res int DEFAULT 0;
SELECT count(*)/2 INTO res FROM t1;
RETURN res;
END;
|
CREATE PROCEDURE fill_t2 (IN upb int)
BEGIN
DECLARE cnt int DEFAULT 0;
WHILE cnt < upb DO
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
SET cnt= cnt+1;
END WHILE;
END;
|
CREATE FUNCTION half_t2() RETURNS int
BEGIN
DECLARE res int DEFAULT 0;
SELECT count(*)/2 INTO res FROM t2;
RETURN res;
END;
|
CALL fill_t1 (10);
CALL fill_t2 (10);
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ixi ixi 5 NULL 10 Using where; Using index
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where; Using index
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
i i
connection root1;
SELECT k from t1 WHERE k < half_t1();
k
0
1
2
3
4
SELECT k from t1 WHERE k >= half_t1();
k
5
6
7
8
9
UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
0 1111 0 100
1 1111 1 101
2 1111 2 102
3 1111 3 103
4 1111 4 104
5 105 5 105
6 106 6 106
7 107 7 107
8 108 8 108
9 109 9 109
SELECT * FROM t2 ORDER BY t2.k;
k i j l
0 2222 0 100
1 2222 1 101
2 2222 2 102
3 2222 3 103
4 2222 4 104
5 105 5 105
6 106 6 106
7 107 7 107
8 108 8 108
9 109 9 109
connection default;
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
All row lock test with InnoDB have to be executed with the options
--innodb_lock_wait_timeout=1
--innodb_locks_unsafe_for_binlog
for example
perl mysql-test-run.pl --mysqld=--innodb_lock_wait_timeout=2 --mysqld=--innodb_locks_unsafe_for_binlog --suite=row_lock innodb_row_lock_2
This diff is collapsed.
--source include/have_innodb.inc
SELECT @@global.innodb_table_locks into @table_locks;
SET @@global.innodb_table_locks= OFF;
let $engine= InnoDB;
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
let $indext1= CREATE INDEX ixi ON t1 (i);
let $indext2= CREATE INDEX ixi ON t2 (i);
--source suite/row_lock/include/row_lock.inc
SET @@global.innodb_table_locks= @table_locks;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment