Commit c6bdcd19 authored by joerg@trift2's avatar joerg@trift2

Merge trift2.:/MySQL/M51/mysql-5.1

into  trift2.:/MySQL/M51/push-5.1
parents 78da884e fd3b8651
...@@ -136,6 +136,9 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR ...@@ -136,6 +136,9 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
# generate .map files # generate .map files
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MAP /MAPINFO:EXPORTS") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MAP /MAPINFO:EXPORTS")
# set stack size (see bug#20815)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1048576")
# remove support for Exception handling # remove support for Exception handling
STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_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@ \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common scripts \ @readline_topdir@ sql-common scripts \
@thread_dirs@ pstack \ @thread_dirs@ pstack \
...@@ -148,10 +149,6 @@ test-bt: ...@@ -148,10 +149,6 @@ test-bt:
-cd mysql-test ; MTR_BUILD_THREAD=auto \ -cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress @PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress
# Re-enable the "rowlock" suite when bug#28685 is fixed
# -cd mysql-test ; MTR_BUILD_THREAD=auto \
# @PERL@ ./mysql-test-run.pl --force --comment=rowlock --suite=row_lock
# Re-enable the "jp" suite when bug#28563 is fixed # Re-enable the "jp" suite when bug#28563 is fixed
# -cd mysql-test ; MTR_BUILD_THREAD=auto \ # -cd mysql-test ; MTR_BUILD_THREAD=auto \
# @PERL@ ./mysql-test-run.pl --force --comment=jp --suite=jp # @PERL@ ./mysql-test-run.pl --force --comment=jp --suite=jp
......
...@@ -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
......
...@@ -450,6 +450,29 @@ AC_DEFINE([HAVE_BOOL], [1], [bool is not defined by all C++ compilators]) ...@@ -450,6 +450,29 @@ AC_DEFINE([HAVE_BOOL], [1], [bool is not defined by all C++ compilators])
fi fi
])dnl ])dnl
AC_DEFUN([MYSQL_STACK_DIRECTION],
[AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
[AC_TRY_RUN([#include <stdlib.h>
int find_stack_direction ()
{
static char *addr = 0;
auto char dummy;
if (addr == 0)
{
addr = &dummy;
return find_stack_direction ();
}
else
return (&dummy > addr) ? 1 : -1;
}
int main ()
{
exit (find_stack_direction() < 0);
}], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
ac_cv_c_stack_direction=)])
AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
])dnl
AC_DEFUN([MYSQL_CHECK_LONGLONG_TO_FLOAT], AC_DEFUN([MYSQL_CHECK_LONGLONG_TO_FLOAT],
[ [
AC_MSG_CHECKING(if conversion of longlong to float works) AC_MSG_CHECKING(if conversion of longlong to float works)
...@@ -615,7 +638,6 @@ AC_SUBST(CXX_VERSION) ...@@ -615,7 +638,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
......
...@@ -11,7 +11,7 @@ AC_CANONICAL_SYSTEM ...@@ -11,7 +11,7 @@ AC_CANONICAL_SYSTEM
# When changing major version number please also check switch statement # When changing major version number please also check switch statement
# in mysqlbinlog::check_master_version(). # in mysqlbinlog::check_master_version().
AM_INIT_AUTOMAKE(mysql, 5.1.21-beta) AM_INIT_AUTOMAKE(mysql, 5.1.21-beta)
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
...@@ -1792,6 +1792,8 @@ MYSQL_TYPE_ACCEPT ...@@ -1792,6 +1792,8 @@ MYSQL_TYPE_ACCEPT
#---END: #---END:
# Figure out what type of struct rlimit to use with setrlimit # Figure out what type of struct rlimit to use with setrlimit
MYSQL_TYPE_STRUCT_RLIMIT MYSQL_TYPE_STRUCT_RLIMIT
# Find where the stack goes
MYSQL_STACK_DIRECTION
# We want to skip alloca on irix unconditionally. It may work on some version.. # We want to skip alloca on irix unconditionally. It may work on some version..
MYSQL_FUNC_ALLOCA MYSQL_FUNC_ALLOCA
# Do struct timespec have members tv_sec or ts_sec # Do struct timespec have members tv_sec or ts_sec
......
...@@ -53,8 +53,11 @@ link_sources: ...@@ -53,8 +53,11 @@ link_sources:
@yassl_h_ln_cmd@ @yassl_h_ln_cmd@
echo timestamp > link_sources echo timestamp > link_sources
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
......
...@@ -112,6 +112,9 @@ extern "C" { ...@@ -112,6 +112,9 @@ extern "C" {
/* signal by closing the sockets */ /* signal by closing the sockets */
#define SIGNAL_WITH_VIO_CLOSE 1 #define SIGNAL_WITH_VIO_CLOSE 1
/* On NetWare, stack grows towards lower address */
#define STACK_DIRECTION -1
/* On NetWare, we need to set stack size for threads, otherwise default 16K is used */ /* On NetWare, we need to set stack size for threads, otherwise default 16K is used */
#define NW_THD_STACKSIZE 65536 #define NW_THD_STACKSIZE 65536
......
...@@ -250,6 +250,8 @@ inline double ulonglong2double(ulonglong value) ...@@ -250,6 +250,8 @@ inline double ulonglong2double(ulonglong value)
#endif #endif
#define STACK_DIRECTION -1
/* Optimized store functions for Intel x86 */ /* Optimized store functions for Intel x86 */
#ifndef _WIN64 #ifndef _WIN64
......
...@@ -804,6 +804,10 @@ typedef SOCKET_SIZE_TYPE size_socket; ...@@ -804,6 +804,10 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define ulong_to_double(X) ((double) (ulong) (X)) #define ulong_to_double(X) ((double) (ulong) (X))
#define SET_STACK_SIZE(X) /* Not needed on real machines */ #define SET_STACK_SIZE(X) /* Not needed on real machines */
#ifndef STACK_DIRECTION
#error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS"
#endif
#if !defined(HAVE_STRTOK_R) #if !defined(HAVE_STRTOK_R)
#define strtok_r(A,B,C) strtok((A),(B)) #define strtok_r(A,B,C) strtok((A),(B))
#endif #endif
......
...@@ -28,9 +28,6 @@ EXTRA_DIST = $(EXTRA_SCRIPTS) suite ...@@ -28,9 +28,6 @@ EXTRA_DIST = $(EXTRA_SCRIPTS) suite
GENSCRIPTS = mysql-test-run-shell install_test_db mtr mysql-test-run GENSCRIPTS = mysql-test-run-shell install_test_db mtr mysql-test-run
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 std_data/client-cert.pem \
std_data/cacert.pem std_data/server-cert.pem \
std_data/server-key.pem
CLEANFILES = $(GENSCRIPTS) CLEANFILES = $(GENSCRIPTS)
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I.. INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
......
...@@ -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
......
File mode changed from 100644 to 100755
...@@ -6055,6 +6055,7 @@ INTO OUTFILE '../tmp/out.innodb.db.file' ...@@ -6055,6 +6055,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
...@@ -6063,7 +6064,7 @@ INTO OUTFILE '../tmp/out.innodb.user.file' ...@@ -6063,7 +6064,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
......
This source diff could not be displayed because it is too large. You can view the blob instead.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -242,7 +242,7 @@ create table t1 (f1 integer) engine = innodb; ...@@ -242,7 +242,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;
......
...@@ -492,9 +492,8 @@ BEGIN ...@@ -492,9 +492,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;
......
...@@ -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;
......
...@@ -6038,6 +6038,7 @@ INTO OUTFILE '../tmp/out.memory.db.file' ...@@ -6038,6 +6038,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
...@@ -6046,7 +6047,7 @@ INTO OUTFILE '../tmp/out.memory.user.file' ...@@ -6046,7 +6047,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
......
This source diff could not be displayed because it is too large. You can view the blob instead.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -238,7 +238,7 @@ create table t1 (f1 integer) engine = memory; ...@@ -238,7 +238,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;
......
...@@ -488,9 +488,8 @@ BEGIN ...@@ -488,9 +488,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;
......
...@@ -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;
......
...@@ -6108,6 +6108,7 @@ INTO OUTFILE '../tmp/out.myisam.db.file' ...@@ -6108,6 +6108,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
...@@ -6116,7 +6117,7 @@ INTO OUTFILE '../tmp/out.myisam.user.file' ...@@ -6116,7 +6117,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
......
This source diff could not be displayed because it is too large. You can view the blob instead.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -242,7 +242,7 @@ create table t1 (f1 integer) engine = myisam; ...@@ -242,7 +242,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;
......
...@@ -492,9 +492,8 @@ BEGIN ...@@ -492,9 +492,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;
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -273,7 +273,7 @@ let $message= Testcase 3.5.1.8:; ...@@ -273,7 +273,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;
......
...@@ -606,7 +606,8 @@ let $col_type= my_year; ...@@ -606,7 +606,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;
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 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;
|
CALL fill_t1 (40);
CALL fill_t2 (40);
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
i i
100 100
102 102
104 104
106 106
108 108
110 110
112 112
114 114
116 116
118 118
120 120
122 122
124 124
126 126
128 128
130 130
132 132
134 134
136 136
138 138
connection root1;
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
i i
101 101
103 103
105 105
107 107
109 109
111 111
113 113
115 115
117 117
119 119
121 121
123 123
125 125
127 127
129 129
131 131
133 133
135 135
137 137
139 139
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;
k i j l
0 100 0 100
1 1111 1 101
2 102 2 102
3 1111 3 103
4 104 4 104
5 1111 5 105
6 106 6 106
7 1111 7 107
8 108 8 108
9 1111 9 109
10 110 10 110
11 1111 11 111
12 112 12 112
13 1111 13 113
14 114 14 114
15 1111 15 115
16 116 16 116
17 1111 17 117
18 118 18 118
19 1111 19 119
SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
k i j l
0 100 0 100
1 2222 1 101
2 102 2 102
3 2222 3 103
4 104 4 104
5 2222 5 105
6 106 6 106
7 2222 7 107
8 108 8 108
9 2222 9 109
10 110 10 110
11 2222 11 111
12 112 12 112
13 2222 13 113
14 114 14 114
15 2222 15 115
16 116 16 116
17 2222 17 117
18 118 18 118
19 2222 19 119
connection default;
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
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 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;
|
CALL fill_t1 (40);
CALL fill_t2 (40);
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
i i
100 100
102 102
104 104
106 106
108 108
110 110
112 112
114 114
116 116
118 118
120 120
122 122
124 124
126 126
128 128
130 130
132 132
134 134
136 136
138 138
connection root1;
DELETE FROM t1 WHERE t1.k % 2 = 1;
SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
k i j l
0 100 0 100
2 102 2 102
4 104 4 104
6 106 6 106
8 108 8 108
10 110 10 110
12 112 12 112
14 114 14 114
16 116 16 116
18 118 18 118
SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
k i j l
0 100 0 100
1 101 1 101
2 102 2 102
3 103 3 103
4 104 4 104
5 105 5 105
6 106 6 106
7 107 7 107
8 108 8 108
9 109 9 109
10 110 10 110
11 111 11 111
12 112 12 112
13 113 13 113
14 114 14 114
15 115 15 115
16 116 16 116
17 117 17 117
18 118 18 118
19 119 19 119
connection default;
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
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;
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);
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
FOR EACH ROW BEGIN
UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
END;
|
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 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
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
i
123
124
connection root1;
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 123 1 123
2 124 2 124
3 125 3 225
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 t2 SET t2.i=223 WHERE t2.i=123;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 123 1 223
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 t2 SET t2.i=226 WHERE t2.i=126;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 123 1 123
2 124 2 124
3 125 3 225
4 126 4 226
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 t2 SET t2.i=224 WHERE t2.i=124;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 123 1 223
2 124 2 224
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 125 3 225
4 126 4 226
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 123 1 223
2 124 2 224
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 123 1 223
2 124 2 224
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 123 1 223
2 124 2 224
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;
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;
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);
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
FOR EACH ROW BEGIN
UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
END;
|
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 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
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
i
123
124
connection root1;
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
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;
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);
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
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 v1 SET i=325 where i=125;
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;
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);
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 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 index NULL PRIMARY 4 NULL 4 Using index
SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
i
123
124
123
124
123
124
123
124
connection root1;
UPDATE v1 SET i=325 where i=125;
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;
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);
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
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 v1 SET i=323 where i=123;
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;
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);
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 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 index NULL PRIMARY 4 NULL 4 Using index
SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
i
123
124
123
124
123
124
123
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;
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);
INSERT INTO t1 VALUES (5,127,5,127);
INSERT INTO t1 VALUES (6,128,6,128);
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);
INSERT INTO t2 VALUES (5,127,5,127);
INSERT INTO t2 VALUES (6,128,6,128);
CREATE INDEX ixi ON t2 (i);
CREATE VIEW v1 AS SELECT t1.i from t1;
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;
|
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ixi ixi 5 NULL 6 Using where; Using index
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
i
123
124
connection root1;
CALL stp_t (125, 225);
i
123
124
126
127
128
225
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 126 4 126
5 127 5 127
6 128 6 128
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 126 4 126
5 127 5 127
6 128 6 128
connection root2;
CALL stp_t (127, 227);
i
123
124
125
126
128
227
k i j l
1 123 1 123
2 124 2 124
3 125 3 125
4 126 4 126
5 227 5 127
6 128 6 128
k i j l
1 123 1 123
2 124 2 124
3 125 3 125
4 126 4 126
5 227 5 127
6 128 6 128
connection default;
CALL stp_t (123, 223);
i
124
125
126
127
128
223
k i j l
1 223 1 123
2 124 2 124
3 125 3 125
4 126 4 126
5 127 5 127
6 128 6 128
k i j l
1 223 1 123
2 124 2 124
3 125 3 125
4 126 4 126
5 127 5 127
6 128 6 128
connection root1;
CALL stp_t (126, 226);
i
123
124
127
128
225
226
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 226 4 126
5 127 5 127
6 128 6 128
k i j l
1 123 1 123
2 124 2 124
3 225 3 125
4 226 4 126
5 127 5 127
6 128 6 128
connection root2;
CALL stp_t (128, 228);
i
123
124
125
126
227
228
k i j l
1 123 1 123
2 124 2 124
3 125 3 125
4 126 4 126
5 227 5 127
6 228 6 128
k i j l
1 123 1 123
2 124 2 124
3 125 3 125
4 126 4 126
5 227 5 127
6 228 6 128
connection default;
CALL stp_t (124, 224);
i
125
126
127
128
223
224
k i j l
1 223 1 123
2 224 2 124
3 125 3 125
4 126 4 126
5 127 5 127
6 128 6 128
k i j l
1 223 1 123
2 224 2 124
3 125 3 125
4 126 4 126
5 127 5 127
6 128 6 128
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
5 127 5 127
6 128 6 128
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
5 127 5 127
6 128 6 128
connection root2;
DELETE FROM t1 WHERE t1.i=228;
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 123 1 123
2 124 2 124
3 125 3 125
4 126 4 126
5 227 5 127
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 123 1 123
2 124 2 124
3 125 3 125
4 126 4 126
5 227 5 127
6 228 6 128
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
5 127 5 127
6 128 6 128
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
5 127 5 127
6 128 6 128
COMMIT;
connection root1;
ROLLBACK;
connection root1;
COMMIT;
connection default;
SELECT * FROM v1 ORDER BY i;
i
125
126
127
128
223
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 223 1 123
3 125 3 125
4 126 4 126
5 127 5 127
6 128 6 128
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
5 127 5 127
6 128 6 128
connection root1;
SELECT * FROM v1 ORDER BY i;
i
125
126
127
128
223
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 223 1 123
3 125 3 125
4 126 4 126
5 127 5 127
6 128 6 128
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
5 127 5 127
6 128 6 128
connection root2;
SELECT * FROM v1 ORDER BY i;
i
123
124
125
126
227
SELECT * FROM t1 ORDER BY t1.k;
k i j l
1 123 1 123
2 124 2 124
3 125 3 125
4 126 4 126
5 227 5 127
SELECT * FROM t2 ORDER BY t2.k;
k i j l
1 123 1 123
2 124 2 124
3 125 3 125
4 126 4 126
5 227 5 127
6 228 6 128
connection default;
DROP TABLE t1, t2;
DROP VIEW v1;
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;
DROP VIEW IF EXISTS v1;
SET autocommit=0;
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);
INSERT INTO t1 VALUES (5,127,5,127);
INSERT INTO t1 VALUES (6,128,6,128);
#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);
INSERT INTO t2 VALUES (5,127,5,127);
INSERT INTO t2 VALUES (6,128,6,128);
#CREATE INDEX ixi ON t2 (i);
CREATE VIEW v1 AS SELECT t1.i from t1;
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;
|
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
i
123
124
connection root1;
CALL stp_t (125, 225);
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;
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);
CREATE VIEW v1 AS SELECT t1.i from t1;
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
FOR EACH ROW BEGIN
UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
END;
|
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 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
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
i
123
124
connection root1;
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
SELECT * FROM v1 ORDER BY i;
i
123
124
126
225
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 t2 SET t2.i=223 WHERE t2.i=123;
SELECT * FROM v1 ORDER BY i;
i
124
125
126
223
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 t2 SET t2.i=226 WHERE t2.i=126;
SELECT * FROM v1 ORDER BY i;
i
123
124
225
226
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 t2 SET t2.i=224 WHERE t2.i=124;
SELECT * FROM v1 ORDER BY i;
i
125
126
223
224
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 v1 ORDER BY i;
i
125
126
223
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 v1 ORDER BY i;
i
125
126
223
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;
DROP VIEW v1;
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;
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;
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);
CREATE VIEW v1 AS SELECT t1.i from t1;
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
FOR EACH ROW BEGIN
UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
END;
|
COMMIT;
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 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
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
i
123
124
connection root1;
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
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=NDB;
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=NDB;
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 range ixi ixi 5 NULL 10 Using where
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 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 * 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;
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=NDB;
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=NDB;
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;
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=NDB;
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=NDB;
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;
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=NDB;
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=NDB;
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 range ixi ixi 5 NULL 10 Using where
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 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 * 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;
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