mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
new merge from next-mr
This commit is contained in:
@ -1000,4 +1000,50 @@ ALTER TABLE t1 MODIFY b ENUM('a', 'z', 'b', 'c') NOT NULL;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#45567: Fast ALTER TABLE broken for enum and set
|
||||
--echo #
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a ENUM('a1','a2'));
|
||||
INSERT INTO t1 VALUES ('a1'),('a2');
|
||||
--enable_info
|
||||
--echo # No copy: No modification
|
||||
ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2');
|
||||
--echo # No copy: Add new enumeration to the end
|
||||
ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a3');
|
||||
--echo # Copy: Modify and add new to the end
|
||||
ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','xx','a5');
|
||||
--echo # Copy: Remove from the end
|
||||
ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','xx');
|
||||
--echo # Copy: Add new enumeration
|
||||
ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a0','xx');
|
||||
--echo # No copy: Add new enumerations to the end
|
||||
ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a0','xx','a5','a6');
|
||||
--disable_info
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a SET('a1','a2'));
|
||||
INSERT INTO t1 VALUES ('a1'),('a2');
|
||||
--enable_info
|
||||
--echo # No copy: No modification
|
||||
ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2');
|
||||
--echo # No copy: Add new to the end
|
||||
ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a3');
|
||||
--echo # Copy: Modify and add new to the end
|
||||
ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','xx','a5');
|
||||
--echo # Copy: Remove from the end
|
||||
ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','xx');
|
||||
--echo # Copy: Add new member
|
||||
ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx');
|
||||
--echo # No copy: Add new to the end
|
||||
ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6');
|
||||
--echo # Copy: Numerical incrase (pack lenght)
|
||||
ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6','a7','a8','a9','a10');
|
||||
--disable_info
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
2
mysql-test/t/bug46760-master.opt
Normal file
2
mysql-test/t/bug46760-master.opt
Normal file
@ -0,0 +1,2 @@
|
||||
--innodb-lock-wait-timeout=2
|
||||
--innodb-file-per-table
|
38
mysql-test/t/bug46760.test
Normal file
38
mysql-test/t/bug46760.test
Normal file
@ -0,0 +1,38 @@
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug#46760: Fast ALTER TABLE no longer works for InnoDB
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
--echo # By using --enable_info and verifying that number of affected
|
||||
--echo # rows is 0 we check that this ALTER TABLE is really carried
|
||||
--echo # out as "fast/online" operation, i.e. without full-blown data
|
||||
--echo # copying.
|
||||
--echo #
|
||||
--echo # I.e. info for the below statement should normally look like:
|
||||
--echo #
|
||||
--echo # affected rows: 0
|
||||
--echo # info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
|
||||
--enable_info
|
||||
ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 10;
|
||||
--disable_info
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MySQL Bug#39200: optimize table does not recognize
|
||||
--echo # ROW_FORMAT=COMPRESSED
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT) ROW_FORMAT=compressed;
|
||||
SHOW CREATE TABLE t1;
|
||||
OPTIMIZE TABLE t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
@ -88,6 +88,10 @@ select group_concat(hex(c1) order by hex(c1)) from t1 group by c1;
|
||||
select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1;
|
||||
drop table t1;
|
||||
|
||||
--echo Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20
|
||||
set names latin1;
|
||||
show collation like 'latin1_test';
|
||||
select "foo" = "foo " collate latin1_test;
|
||||
|
||||
-- echo The following tests check that two-byte collation IDs work
|
||||
# The file ../std-data/Index.xml has a number of collations with high IDs.
|
||||
|
420
mysql-test/t/debug_sync.test
Normal file
420
mysql-test/t/debug_sync.test
Normal file
@ -0,0 +1,420 @@
|
||||
###################### t/debug_sync.test ###############################
|
||||
# #
|
||||
# Testing of the Debug Sync Facility. #
|
||||
# #
|
||||
# There is important documentation within sql/debug_sync.cc #
|
||||
# #
|
||||
# Used objects in this test case: #
|
||||
# p0 - synchronization point 0. Non-existent dummy sync point. #
|
||||
# s1 - signal 1. #
|
||||
# s2 - signal 2. #
|
||||
# #
|
||||
# Creation: #
|
||||
# 2008-02-18 istruewing #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
#
|
||||
# We need the Debug Sync Facility.
|
||||
#
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
#
|
||||
# We are checking privileges, which the embedded server cannot do.
|
||||
#
|
||||
--source include/not_embedded.inc
|
||||
|
||||
#
|
||||
# Preparative cleanup.
|
||||
#
|
||||
--disable_warnings
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Show the special system variable.
|
||||
# It shows ON or OFF depending on the command line option --debug-sync.
|
||||
# The test case assumes it is ON (command line option present).
|
||||
#
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
|
||||
#
|
||||
# Syntax. Valid forms.
|
||||
#
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 EXECUTE 2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE 2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE 2';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 EXECUTE 2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 EXECUTE 2';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2';
|
||||
SET DEBUG_SYNC='p0 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 CLEAR';
|
||||
SET DEBUG_SYNC='p0 TEST';
|
||||
SET DEBUG_SYNC='RESET';
|
||||
|
||||
#
|
||||
# Syntax. Valid forms. Lower case.
|
||||
#
|
||||
set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2 hit_limit 3';
|
||||
set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2';
|
||||
set debug_sync='p0 signal s1 wait_for s2 timeout 6 hit_limit 3';
|
||||
set debug_sync='p0 signal s1 wait_for s2 timeout 6';
|
||||
set debug_sync='p0 signal s1 wait_for s2 execute 2 hit_limit 3';
|
||||
set debug_sync='p0 signal s1 wait_for s2 execute 2';
|
||||
set debug_sync='p0 signal s1 wait_for s2 hit_limit 3';
|
||||
set debug_sync='p0 signal s1 wait_for s2';
|
||||
set debug_sync='p0 signal s1 execute 2 hit_limit 3';
|
||||
set debug_sync='p0 signal s1 execute 2';
|
||||
set debug_sync='p0 signal s1 hit_limit 3';
|
||||
set debug_sync='p0 signal s1';
|
||||
set debug_sync='p0 wait_for s2 timeout 6 execute 2 hit_limit 3';
|
||||
set debug_sync='p0 wait_for s2 timeout 6 execute 2';
|
||||
set debug_sync='p0 wait_for s2 timeout 6 hit_limit 3';
|
||||
set debug_sync='p0 wait_for s2 timeout 6';
|
||||
set debug_sync='p0 wait_for s2 execute 2 hit_limit 3';
|
||||
set debug_sync='p0 wait_for s2 execute 2';
|
||||
set debug_sync='p0 wait_for s2 hit_limit 3';
|
||||
set debug_sync='p0 wait_for s2';
|
||||
set debug_sync='p0 hit_limit 3';
|
||||
set debug_sync='p0 clear';
|
||||
set debug_sync='p0 test';
|
||||
set debug_sync='reset';
|
||||
|
||||
#
|
||||
# Syntax. Valid forms. Line wrap, leading, mid, trailing space.
|
||||
#
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6
|
||||
EXECUTE 2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 ';
|
||||
SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2 ';
|
||||
SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2 ';
|
||||
|
||||
#
|
||||
# Syntax. Invalid forms.
|
||||
#
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC=' ';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 EXECUTE 2';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 TIMEOUT 6 EXECUTE 2';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 TIMEOUT 6';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 EXECUTE 2';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1 EXECUTE 2';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2 EXECUTE 2';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 TIMEOUT 6';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 EXECUTE 2 SIGNAL s1 TIMEOUT 6';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 TIMEOUT 6 SIGNAL s1';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 EXECUTE 2 TIMEOUT 6 SIGNAL s1';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 CLEAR HIT_LIMIT 3';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='CLEAR';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 CLEAR p0';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='TEST';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 TEST p0';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 RESET';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='RESET p0';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 RESET p0';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 SIGNAL ';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR ';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE ';
|
||||
|
||||
#
|
||||
# Syntax. Invalid keywords used.
|
||||
#
|
||||
--error ER_UNKNOWN_SYSTEM_VARIABLE
|
||||
SET DEBUG_SYNCx='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 SIGNAx s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOx s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUx 0 EXECUTE 2 HIT_LIMIT 3';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTx 2 HIT_LIMIT 3';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIx 3';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 CLEARx';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 TESTx';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='RESETx';
|
||||
|
||||
#
|
||||
# Syntax. Invalid numbers. Decimal only.
|
||||
#
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 0x6 EXECUTE 2 HIT_LIMIT 3';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 0x2 HIT_LIMIT 3';
|
||||
--error ER_PARSE_ERROR
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 7 EXECUTE 2 HIT_LIMIT 0x3';
|
||||
|
||||
#
|
||||
# Syntax. Invalid value type.
|
||||
#
|
||||
--error ER_WRONG_TYPE_FOR_VAR
|
||||
SET DEBUG_SYNC= 7;
|
||||
|
||||
#
|
||||
# Syntax. DEBUG_SYNC is a SESSION-only variable.
|
||||
#
|
||||
--error ER_LOCAL_VARIABLE
|
||||
SET GLOBAL DEBUG_SYNC= 'p0 CLEAR';
|
||||
|
||||
#
|
||||
# Syntax. The variable value does not need to be a string literal.
|
||||
#
|
||||
SET @myvar= 'now SIGNAL from_myvar';
|
||||
SET DEBUG_SYNC= @myvar;
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
#
|
||||
SET DEBUG_SYNC= LEFT('now SIGNAL from_function_cut_here', 24);
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
|
||||
#
|
||||
# Functional tests.
|
||||
#
|
||||
# NOTE: There is the special synchronization point 'now'. It is placed
|
||||
# immediately after setting of the DEBUG_SYNC variable.
|
||||
# So it is executed before the SET statement ends.
|
||||
#
|
||||
# NOTE: There is only one global signal (say "signal post" or "flag mast").
|
||||
# A SIGNAL action writes its signal into it ("sets a flag").
|
||||
# The signal persists until explicitly overwritten.
|
||||
# To avoid confusion for later tests, it is recommended to clear
|
||||
# the signal by signalling "empty" ("setting the 'empty' flag"):
|
||||
# SET DEBUG_SYNC= 'now SIGNAL empty';
|
||||
# Preferably you can reset the whole facility with:
|
||||
# SET DEBUG_SYNC= 'RESET';
|
||||
# The signal is then '' (really empty) which connot be done otherwise.
|
||||
#
|
||||
|
||||
#
|
||||
# Time out immediately. This gives just a warning.
|
||||
#
|
||||
SET DEBUG_SYNC= 'now SIGNAL something';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
# Suppress warning number
|
||||
--replace_column 2 ####
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
|
||||
#
|
||||
# If signal is present already, TIMEOUT 0 does not give a warning.
|
||||
#
|
||||
SET DEBUG_SYNC= 'now SIGNAL nothing';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
|
||||
|
||||
#
|
||||
# EXECUTE 0 is effectively a no-op.
|
||||
#
|
||||
SET DEBUG_SYNC= 'now SIGNAL something EXECUTE 0';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR anotherthing TIMEOUT 0 EXECUTE 0';
|
||||
|
||||
#
|
||||
# Run into HIT_LIMIT. This gives an error.
|
||||
#
|
||||
--error ER_DEBUG_SYNC_HIT_LIMIT
|
||||
SET DEBUG_SYNC= 'now HIT_LIMIT 1';
|
||||
|
||||
#
|
||||
# Many actions. Watch the array growing and shrinking in the debug trace:
|
||||
# egrep 'query:|debug_sync_action:' mysql-test/var/log/master.trace
|
||||
#
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
SET DEBUG_SYNC= 'p1abcd SIGNAL s1 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p2abc SIGNAL s2 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p9abcdef SIGNAL s9 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p4a SIGNAL s4 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p5abcde SIGNAL s5 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p6ab SIGNAL s6 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p7 SIGNAL s7 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p8abcdef SIGNAL s8 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p3abcdef SIGNAL s3 EXECUTE 2';
|
||||
#
|
||||
# Execute some actions to show they exist. Each sets a distinct signal.
|
||||
#
|
||||
SET DEBUG_SYNC= 'p4a TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
SET DEBUG_SYNC= 'p1abcd TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
SET DEBUG_SYNC= 'p7 TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
SET DEBUG_SYNC= 'p9abcdef TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
SET DEBUG_SYNC= 'p3abcdef TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
#
|
||||
# Clear the actions.
|
||||
#
|
||||
SET DEBUG_SYNC= 'p1abcd CLEAR';
|
||||
SET DEBUG_SYNC= 'p2abc CLEAR';
|
||||
SET DEBUG_SYNC= 'p5abcde CLEAR';
|
||||
SET DEBUG_SYNC= 'p6ab CLEAR';
|
||||
SET DEBUG_SYNC= 'p8abcdef CLEAR';
|
||||
SET DEBUG_SYNC= 'p9abcdef CLEAR';
|
||||
SET DEBUG_SYNC= 'p3abcdef CLEAR';
|
||||
SET DEBUG_SYNC= 'p4a CLEAR';
|
||||
SET DEBUG_SYNC= 'p7 CLEAR';
|
||||
#
|
||||
# Execute some actions to show they have gone.
|
||||
#
|
||||
SET DEBUG_SYNC= 'p1abcd TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
SET DEBUG_SYNC= 'p7 TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
SET DEBUG_SYNC= 'p9abcdef TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
#
|
||||
# Now cleanup. Actions are clear already, but signal needs to be cleared.
|
||||
#
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
|
||||
#
|
||||
# Facility requires SUPER privilege.
|
||||
#
|
||||
CREATE USER mysqltest_1@localhost;
|
||||
GRANT SUPER ON *.* TO mysqltest_1@localhost;
|
||||
--echo connection con1, mysqltest_1
|
||||
connect (con1,localhost,mysqltest_1,,);
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
disconnect con1;
|
||||
--echo connection default
|
||||
connection default;
|
||||
DROP USER mysqltest_1@localhost;
|
||||
#
|
||||
CREATE USER mysqltest_2@localhost;
|
||||
GRANT ALL ON *.* TO mysqltest_2@localhost;
|
||||
REVOKE SUPER ON *.* FROM mysqltest_2@localhost;
|
||||
--echo connection con1, mysqltest_2
|
||||
connect (con1,localhost,mysqltest_2,,);
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
disconnect con1;
|
||||
--echo connection default
|
||||
connection default;
|
||||
DROP USER mysqltest_2@localhost;
|
||||
|
||||
#
|
||||
# Example 1.
|
||||
#
|
||||
# Preparative cleanup.
|
||||
--disable_warnings
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
#
|
||||
# Test.
|
||||
CREATE TABLE t1 (c1 INT);
|
||||
--echo connection con1
|
||||
connect (con1,localhost,root,,);
|
||||
SET DEBUG_SYNC= 'before_lock_tables_takes_lock
|
||||
SIGNAL opened WAIT_FOR flushed';
|
||||
send INSERT INTO t1 VALUES(1);
|
||||
--echo connection default
|
||||
connection default;
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR opened';
|
||||
SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
|
||||
FLUSH TABLE t1;
|
||||
--echo connection con1
|
||||
connection con1;
|
||||
reap;
|
||||
disconnect con1;
|
||||
--echo connection default
|
||||
connection default;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Example 2.
|
||||
#
|
||||
# Preparative cleanup.
|
||||
--disable_warnings
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
#
|
||||
# Test.
|
||||
CREATE TABLE t1 (c1 INT);
|
||||
LOCK TABLE t1 WRITE;
|
||||
--echo connection con1
|
||||
connect (con1,localhost,root,,);
|
||||
# Retain action after use. First used by general_log.
|
||||
SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
|
||||
send INSERT INTO t1 VALUES (1);
|
||||
--echo connection default
|
||||
connection default;
|
||||
# Wait until INSERT waits for lock.
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR locked';
|
||||
# let INSERT continue.
|
||||
UNLOCK TABLES;
|
||||
--echo connection con1
|
||||
connection con1;
|
||||
--echo retrieve INSERT result.
|
||||
reap;
|
||||
disconnect con1;
|
||||
--echo connection default
|
||||
connection default;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Cleanup after test case.
|
||||
# Otherwise signal would contain 'flushed' here,
|
||||
# which could confuse the next test.
|
||||
#
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
|
@ -292,3 +292,47 @@ DROP TABLE t1;
|
||||
DROP FUNCTION f1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # Bug#46958: Assertion in Diagnostics_area::set_ok_status, trigger,
|
||||
--echo # merge table
|
||||
--echo #
|
||||
CREATE TABLE t1 ( a INT );
|
||||
CREATE TABLE t2 ( a INT );
|
||||
CREATE TABLE t3 ( a INT );
|
||||
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
INSERT INTO t2 VALUES (1), (2);
|
||||
INSERT INTO t3 VALUES (1), (2);
|
||||
|
||||
CREATE TRIGGER tr1 BEFORE DELETE ON t2
|
||||
FOR EACH ROW INSERT INTO no_such_table VALUES (1);
|
||||
|
||||
--error ER_NO_SUCH_TABLE
|
||||
DELETE t1, t2, t3 FROM t1, t2, t3;
|
||||
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
SELECT * FROM t3;
|
||||
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
CREATE TABLE t1 ( a INT );
|
||||
CREATE TABLE t2 ( a INT );
|
||||
CREATE TABLE t3 ( a INT );
|
||||
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
INSERT INTO t2 VALUES (1), (2);
|
||||
INSERT INTO t3 VALUES (1), (2);
|
||||
|
||||
CREATE TRIGGER tr1 AFTER DELETE ON t2
|
||||
FOR EACH ROW INSERT INTO no_such_table VALUES (1);
|
||||
|
||||
--error ER_NO_SUCH_TABLE
|
||||
DELETE t1, t2, t3 FROM t1, t2, t3;
|
||||
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
SELECT * FROM t3;
|
||||
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
@ -12,3 +12,6 @@
|
||||
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
|
||||
innodb_bug39438 : Bug#42383 2009-01-28 lsoares "This fails in embedded and on windows. Note that this test is not run on windows and on embedded in PB for main trees currently"
|
||||
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
|
||||
partition_innodb_builtin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes
|
||||
partition_innodb_plugin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes
|
||||
innodb_bug46000 : Bug#47860 2009-10-16 satyab Test fails for innodb plugin 1.0.5
|
||||
|
@ -1006,3 +1006,51 @@ DROP TABLE t1;
|
||||
|
||||
###
|
||||
--echo End of 5.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # BUG#47280 - strange results from count(*) with order by multiple
|
||||
--echo # columns without where/group
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # Initialize test
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (
|
||||
pk INT NOT NULL,
|
||||
i INT,
|
||||
PRIMARY KEY (pk)
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,11),(2,12),(3,13);
|
||||
|
||||
--echo #
|
||||
--echo # Start test
|
||||
--echo # All the following queries shall return 1 record
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
--echo # Masking all correct values {11...13} for column i in this result.
|
||||
--replace_column 2 #
|
||||
SELECT MAX(pk) as max, i
|
||||
FROM t1
|
||||
ORDER BY max;
|
||||
|
||||
--echo
|
||||
EXPLAIN
|
||||
SELECT MAX(pk) as max, i
|
||||
FROM t1
|
||||
ORDER BY max;
|
||||
|
||||
--echo
|
||||
--echo # Only 11 is correct for collumn i in this result
|
||||
SELECT MAX(pk) as max, i
|
||||
FROM t1
|
||||
WHERE pk<2
|
||||
ORDER BY max;
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup
|
||||
--echo #
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -456,4 +456,89 @@ SELECT SUM( DISTINCT e ) FROM t1 GROUP BY b,c,d HAVING (b,c,d) IN
|
||||
((AVG( 1 ), 1 + c, 1 + d), (AVG( 1 ), 2 + c, 2 + d));
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #44139: Table scan when NULL appears in IN clause
|
||||
--echo #
|
||||
|
||||
--disable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
c_int INT NOT NULL,
|
||||
c_decimal DECIMAL(5,2) NOT NULL,
|
||||
c_float FLOAT(5, 2) NOT NULL,
|
||||
c_bit BIT(10) NOT NULL,
|
||||
c_date DATE NOT NULL,
|
||||
c_datetime DATETIME NOT NULL,
|
||||
c_timestamp TIMESTAMP NOT NULL,
|
||||
c_time TIME NOT NULL,
|
||||
c_year YEAR NOT NULL,
|
||||
c_char CHAR(10) NOT NULL,
|
||||
INDEX(c_int), INDEX(c_decimal), INDEX(c_float), INDEX(c_bit), INDEX(c_date),
|
||||
INDEX(c_datetime), INDEX(c_timestamp), INDEX(c_time), INDEX(c_year),
|
||||
INDEX(c_char));
|
||||
|
||||
INSERT INTO t1 (c_int) VALUES (1), (2), (3), (4), (5);
|
||||
INSERT INTO t1 (c_int) SELECT 0 FROM t1;
|
||||
INSERT INTO t1 (c_int) SELECT 0 FROM t1;
|
||||
|
||||
--enable_warnings
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, 1, 2, 3);
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, NULL, 2, NULL, 3, NULL);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, NULL);
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (1, 2, 3);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, 1, 2, 3);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, NULL);
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_float IN (1, 2, 3);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, 1, 2, 3);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, NULL);
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_bit IN (1, 2, 3);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, 1, 2, 3);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, NULL);
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_date
|
||||
IN ('2009-09-01', '2009-09-02', '2009-09-03');
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_date
|
||||
IN (NULL, '2009-09-01', '2009-09-02', '2009-09-03');
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL, NULL);
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_datetime
|
||||
IN ('2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_datetime
|
||||
IN (NULL, '2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL, NULL);
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_timestamp
|
||||
IN ('2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_timestamp
|
||||
IN (NULL, '2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL, NULL);
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_year IN (1, 2, 3);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, 1, 2, 3);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, NULL);
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_char IN ('1', '2', '3');
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, '1', '2', '3');
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL);
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL);
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -184,7 +184,6 @@ show fields from testdb_1.v7;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
show create view testdb_1.v7;
|
||||
|
||||
--error ER_VIEW_NO_EXPLAIN
|
||||
show create view v4;
|
||||
#--error ER_VIEW_NO_EXPLAIN
|
||||
show fields from v4;
|
||||
|
1
mysql-test/t/innodb-consistent-master.opt
Normal file
1
mysql-test/t/innodb-consistent-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--innodb_lock_wait_timeout=2
|
58
mysql-test/t/innodb-consistent.test
Normal file
58
mysql-test/t/innodb-consistent.test
Normal file
@ -0,0 +1,58 @@
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
|
||||
# a consistent read of the source table.
|
||||
|
||||
connect (a,localhost,root,,);
|
||||
connect (b,localhost,root,,);
|
||||
connection a;
|
||||
set session transaction isolation level read committed;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
create table t2 like t1;
|
||||
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
|
||||
set autocommit=0;
|
||||
|
||||
# REPLACE INTO ... SELECT case
|
||||
begin;
|
||||
# this should not result in any locks on t2.
|
||||
replace into t1 select * from t2;
|
||||
|
||||
connection b;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
# should not cuase a lock wait.
|
||||
delete from t2 where a=5;
|
||||
commit;
|
||||
delete from t2;
|
||||
commit;
|
||||
connection a;
|
||||
commit;
|
||||
|
||||
# INSERT INTO ... SELECT case
|
||||
begin;
|
||||
# this should not result in any locks on t2.
|
||||
insert into t1 select * from t2;
|
||||
|
||||
connection b;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
# should not cuase a lock wait.
|
||||
delete from t2 where a=5;
|
||||
commit;
|
||||
delete from t2;
|
||||
commit;
|
||||
connection a;
|
||||
commit;
|
||||
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
connection default;
|
||||
disconnect a;
|
||||
disconnect b;
|
@ -9,6 +9,7 @@
|
||||
-- disable_result_log
|
||||
|
||||
# set packet size and reconnect
|
||||
let $max_packet=`select @@global.max_allowed_packet`;
|
||||
SET @@global.max_allowed_packet=16777216;
|
||||
--connect (newconn, localhost, root,,)
|
||||
|
||||
@ -32,6 +33,7 @@ SELECT f4, f8 FROM bug34300;
|
||||
|
||||
DROP TABLE bug34300;
|
||||
|
||||
EVAL SET @@global.max_allowed_packet=$max_packet;
|
||||
disconnect newconn;
|
||||
connection default;
|
||||
SET @@global.max_allowed_packet=default;
|
||||
|
27
mysql-test/t/innodb_bug44369.test
Normal file
27
mysql-test/t/innodb_bug44369.test
Normal file
@ -0,0 +1,27 @@
|
||||
# This is the test for bug 44369. We should
|
||||
# block table creation with columns match
|
||||
# some innodb internal reserved key words,
|
||||
# both case sensitively and insensitely.
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
# This create table operation should fail.
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table bug44369 (DB_ROW_ID int) engine=innodb;
|
||||
|
||||
# This create should fail as well
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table bug44369 (db_row_id int) engine=innodb;
|
||||
|
||||
# TODO: after Bug#47233 is fixed, 'show warning' should be replaced by 'show
|
||||
# errors' again.
|
||||
# show errors;
|
||||
show warnings;
|
||||
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table bug44369 (db_TRX_Id int) engine=innodb;
|
||||
|
||||
# TODO: after Bug#47233 is fixed, 'show warning' should be replaced by 'show
|
||||
# errors' again.
|
||||
# show errors;
|
||||
show warnings;
|
17
mysql-test/t/innodb_bug44571.test
Normal file
17
mysql-test/t/innodb_bug44571.test
Normal file
@ -0,0 +1,17 @@
|
||||
#
|
||||
# Bug#44571 InnoDB Plugin crashes on ADD INDEX
|
||||
# http://bugs.mysql.com/44571
|
||||
#
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
|
||||
ALTER TABLE bug44571 CHANGE foo bar INT;
|
||||
-- error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||
ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
|
||||
# The following will fail, because the CHANGE foo bar was
|
||||
# not communicated to InnoDB.
|
||||
--error ER_NOT_KEYFILE
|
||||
ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
|
||||
--error ER_NOT_KEYFILE
|
||||
CREATE INDEX bug44571b ON bug44571 (bar);
|
||||
DROP TABLE bug44571;
|
34
mysql-test/t/innodb_bug46000.test
Normal file
34
mysql-test/t/innodb_bug46000.test
Normal file
@ -0,0 +1,34 @@
|
||||
# This is the test for bug 46000. We shall
|
||||
# block any index creation with the name of
|
||||
# "GEN_CLUST_INDEX", which is the reserved
|
||||
# name for innodb default primary index.
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
# This 'create table' operation should fail because of
|
||||
# using the reserve name as its index name.
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
|
||||
|
||||
# Mixed upper/lower case of the reserved key words
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
|
||||
|
||||
show errors;
|
||||
|
||||
create table bug46000(id int) engine=innodb;
|
||||
|
||||
# This 'create index' operation should fail.
|
||||
--replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create index GEN_CLUST_INDEX on bug46000(id);
|
||||
|
||||
--replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
show errors;
|
||||
|
||||
# This 'create index' operation should succeed, no
|
||||
# temp table left from last failed create index
|
||||
# operation.
|
||||
create index idx on bug46000(id);
|
||||
|
||||
drop table bug46000;
|
@ -729,4 +729,24 @@ SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a;
|
||||
SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;
|
||||
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
|
||||
#
|
||||
# Bug#47150 Assertion in Field_long::val_int() on MERGE + TRIGGER + multi-table UPDATE
|
||||
#
|
||||
CREATE TABLE t1 (f1 int);
|
||||
|
||||
CREATE TABLE t2 (f1 int);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
CREATE VIEW v1 AS SELECT * FROM t2;
|
||||
|
||||
PREPARE stmt FROM 'UPDATE t2 AS A NATURAL JOIN v1 B SET B.f1 = 1';
|
||||
EXECUTE stmt;
|
||||
EXECUTE stmt;
|
||||
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1, t2;
|
||||
|
@ -1503,5 +1503,51 @@ SELECT h+0, d + 0, e, g + 0 FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Test of BUG#35570 CHECKSUM TABLE unreliable if LINESTRING field
|
||||
--echo # (same content / differen checksum)
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam;
|
||||
INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)"));
|
||||
checksum table t1;
|
||||
CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam;
|
||||
INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)"));
|
||||
checksum table t2;
|
||||
CREATE TABLE t3 select * from t1;
|
||||
checksum table t3;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
|
||||
#
|
||||
# BUG#47073 - valgrind errs, corruption,failed repair of partition,
|
||||
# low myisam_sort_buffer_size
|
||||
#
|
||||
CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b));
|
||||
INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'),
|
||||
(6,'0'),(7,'0');
|
||||
INSERT INTO t1 SELECT a+10,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+20,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+40,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+80,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+160,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+320,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+640,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+1280,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+2560,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+5120,b FROM t1;
|
||||
SET myisam_sort_buffer_size=4;
|
||||
REPAIR TABLE t1;
|
||||
|
||||
# !!! Disabled until additional fix for BUG#47073 is pushed.
|
||||
#SET myisam_repair_threads=2;
|
||||
# May report different values depending on threads activity.
|
||||
#--replace_regex /changed from [0-9]+/changed from #/
|
||||
#REPAIR TABLE t1;
|
||||
#SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
|
@ -71,7 +71,8 @@ select "--- --position --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=239 $MYSQLD_DATADIR/master-bin.000002
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=330 $MYSQLD_DATADIR/master-bin.000002
|
||||
|
||||
|
||||
# These are tests for remote binlog.
|
||||
# They should return the same as previous test.
|
||||
@ -107,7 +108,7 @@ select "--- --position --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=239 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=330 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
||||
|
||||
# Bug#7853 mysqlbinlog does not accept input from stdin
|
||||
--disable_query_log
|
||||
@ -377,6 +378,68 @@ FLUSH LOGS;
|
||||
# We do not need the results, just make sure that mysqlbinlog does not crash
|
||||
--exec $MYSQL_BINLOG --hexdump --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 >/dev/null
|
||||
|
||||
#
|
||||
# #46998
|
||||
# This test verifies if the 'BEGIN', 'COMMIT' and 'ROLLBACK' are output
|
||||
# in regardless of database filtering
|
||||
#
|
||||
|
||||
RESET MASTER;
|
||||
FLUSH LOGS;
|
||||
|
||||
# The following three test cases were wrtten into binlog_transaction.000001
|
||||
# Test case1: Test if the 'BEGIN' and 'COMMIT' are output for the 'test' database
|
||||
# in transaction1 base on innodb engine tables
|
||||
# use test;
|
||||
# create table t1(a int) engine= innodb;
|
||||
# use mysql;
|
||||
# create table t2(a int) engine= innodb;
|
||||
# Transaction1 begin
|
||||
# begin;
|
||||
# use test;
|
||||
# insert into t1 (a) values (1);
|
||||
# use mysql;
|
||||
# insert into t2 (a) values (1);
|
||||
# commit;
|
||||
# Transaction1 end
|
||||
|
||||
# Test case2: Test if the 'BEGIN' and 'ROLLBACK' are output for the 'test' database
|
||||
# in transaction2 base on innodb and myisam engine tables
|
||||
# use test;
|
||||
# create table t3(a int) engine= innodb;
|
||||
# use mysql;
|
||||
# create table t4(a int) engine= myisam;
|
||||
# Transaction2 begin
|
||||
# begin;
|
||||
# use test;
|
||||
# insert into t3 (a) values (2);
|
||||
# use mysql;
|
||||
# insert into t4 (a) values (2);
|
||||
# rollback;
|
||||
# Transaction2 end
|
||||
|
||||
# Test case3: Test if the 'BEGIN' and 'COMMIT' are output for the 'test' database
|
||||
# in transaction3 base on NDB engine tables
|
||||
# use test;
|
||||
# create table t5(a int) engine= NDB;
|
||||
# use mysql;
|
||||
# create table t6(a int) engine= NDB;
|
||||
# Transaction3 begin
|
||||
# begin;
|
||||
# use test;
|
||||
# insert into t5 (a) values (3);
|
||||
# use mysql;
|
||||
# insert into t6 (a) values (3);
|
||||
# commit;
|
||||
# Transaction3 end
|
||||
|
||||
--echo #
|
||||
--echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is exist
|
||||
--exec $MYSQL_BINLOG --database=test --short-form $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001
|
||||
--echo #
|
||||
--echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is not exist
|
||||
--exec $MYSQL_BINLOG --database=not_exist --short-form $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -1402,3 +1402,35 @@ SELECT DISTINCT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 0, 9;
|
||||
SELECT DISTINCT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 0, 9;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #43029: FORCE INDEX FOR ORDER BY is ignored when join buffering
|
||||
--echo # is used
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT, KEY (a));
|
||||
|
||||
INSERT INTO t1 VALUES (0, NULL), (1, NULL), (2, NULL), (3, NULL);
|
||||
INSERT INTO t1 SELECT a+4, b FROM t1;
|
||||
INSERT INTO t1 SELECT a+8, b FROM t1;
|
||||
|
||||
CREATE TABLE t2 (a INT, b INT);
|
||||
|
||||
INSERT INTO t2 VALUES (0,NULL), (1,NULL), (2,NULL), (3,NULL), (4,NULL);
|
||||
INSERT INTO t2 SELECT a+4, b FROM t2;
|
||||
|
||||
--echo # shouldn't have "using filesort"
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 FORCE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
|
||||
|
||||
--echo # should have "using filesort"
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 USE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
|
||||
|
||||
--echo # should have "using filesort"
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 FORCE INDEX FOR JOIN (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -61,6 +61,19 @@ SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#44059: rec_per_key on empty partition gives weird optimiser results
|
||||
#
|
||||
create table t1 (a int, b int, key(a))
|
||||
partition by list (a)
|
||||
( partition p0 values in (1),
|
||||
partition p1 values in (2));
|
||||
insert into t1 values (1,1),(2,1),(2,2),(2,3);
|
||||
show indexes from t1;
|
||||
analyze table t1;
|
||||
show indexes from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#36001: Partitions: spelling and using some error messages
|
||||
#
|
||||
|
67
mysql-test/t/partition_innodb_builtin.test
Normal file
67
mysql-test/t/partition_innodb_builtin.test
Normal file
@ -0,0 +1,67 @@
|
||||
--source include/have_partition.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_not_innodb_plugin.inc
|
||||
|
||||
#
|
||||
# Bug#32430 - show engine innodb status causes errors
|
||||
#
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
|
||||
ENGINE=InnoDB
|
||||
PARTITION BY RANGE (a)
|
||||
SUBPARTITION BY HASH (a)
|
||||
(PARTITION `p0``\""e` VALUES LESS THAN (100)
|
||||
(SUBPARTITION `sp0``\""e`,
|
||||
SUBPARTITION `sp1``\""e`),
|
||||
PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
|
||||
(SUBPARTITION `sp2``\""e`,
|
||||
SUBPARTITION `sp3``\""e`));
|
||||
INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
|
||||
START TRANSACTION;
|
||||
--echo # con1
|
||||
connect(con1,localhost,root,,);
|
||||
SET NAMES utf8;
|
||||
START TRANSACTION;
|
||||
--echo # default connection
|
||||
connection default;
|
||||
UPDATE `t``\""e` SET a = 16 WHERE a = 0;
|
||||
--echo # con1
|
||||
connection con1;
|
||||
UPDATE `t``\""e` SET a = 8 WHERE a = 22;
|
||||
let $id_1= `SELECT CONNECTION_ID()`;
|
||||
SEND;
|
||||
UPDATE `t``\""e` SET a = 12 WHERE a = 0;
|
||||
--echo # default connection
|
||||
connection default;
|
||||
let $wait_timeout= 2;
|
||||
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE ID = $id_1 AND STATE = 'Searching rows for update';
|
||||
--source include/wait_condition.inc
|
||||
#--echo # tested wait condition $wait_condition_reps times
|
||||
--error ER_LOCK_DEADLOCK
|
||||
UPDATE `t``\""e` SET a = 4 WHERE a = 22;
|
||||
--echo # First table reported in 'SHOW ENGINE InnoDB STATUS'
|
||||
# RECORD LOCKS space id 0 page no 50 n bits 80 index `PRIMARY` in \
|
||||
# Database `test`, Table `t1`, Partition `p0`, Subpartition `sp0` \
|
||||
# trx id 0 775
|
||||
# NOTE: replace_regex is very slow on match copy/past '(.*)' regex's
|
||||
# on big texts, removing a lot of text before + after makes it much faster.
|
||||
#/.*in (.*) trx.*/\1/
|
||||
--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
|
||||
SHOW ENGINE InnoDB STATUS;
|
||||
set @old_sql_mode = @@sql_mode;
|
||||
set sql_mode = 'ANSI_QUOTES';
|
||||
# INNODB_LOCKS only exists in innodb_plugin
|
||||
#SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
|
||||
--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
|
||||
SHOW ENGINE InnoDB STATUS;
|
||||
set @@sql_mode = @old_sql_mode;
|
||||
--echo # con1
|
||||
connection con1;
|
||||
REAP;
|
||||
ROLLBACK;
|
||||
disconnect con1;
|
||||
--echo # default connection
|
||||
connection default;
|
||||
DROP TABLE `t``\""e`;
|
||||
SET NAMES DEFAULT;
|
75
mysql-test/t/partition_innodb_plugin.test
Normal file
75
mysql-test/t/partition_innodb_plugin.test
Normal file
@ -0,0 +1,75 @@
|
||||
--source include/have_partition.inc
|
||||
--source include/have_innodb.inc
|
||||
--source suite/innodb/include/have_innodb_plugin.inc
|
||||
|
||||
#
|
||||
# Bug#32430 - show engine innodb status causes errors
|
||||
#
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
|
||||
ENGINE=InnoDB
|
||||
PARTITION BY RANGE (a)
|
||||
SUBPARTITION BY HASH (a)
|
||||
(PARTITION `p0``\""e` VALUES LESS THAN (100)
|
||||
(SUBPARTITION `sp0``\""e`,
|
||||
SUBPARTITION `sp1``\""e`),
|
||||
PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
|
||||
(SUBPARTITION `sp2``\""e`,
|
||||
SUBPARTITION `sp3``\""e`));
|
||||
INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
|
||||
START TRANSACTION;
|
||||
--echo # con1
|
||||
connect(con1,localhost,root,,);
|
||||
SET NAMES utf8;
|
||||
START TRANSACTION;
|
||||
--echo # default connection
|
||||
connection default;
|
||||
UPDATE `t``\""e` SET a = 16 WHERE a = 0;
|
||||
--echo # con1
|
||||
connection con1;
|
||||
UPDATE `t``\""e` SET a = 8 WHERE a = 22;
|
||||
let $id_1= `SELECT CONNECTION_ID()`;
|
||||
SEND;
|
||||
UPDATE `t``\""e` SET a = 12 WHERE a = 0;
|
||||
--echo # default connection
|
||||
connection default;
|
||||
let $wait_timeout= 2;
|
||||
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE ID = $id_1 AND STATE = 'Searching rows for update';
|
||||
--source include/wait_condition.inc
|
||||
#--echo # tested wait condition $wait_condition_reps times
|
||||
# INNODB_LOCKS only exists in innodb_plugin
|
||||
--sorted_result
|
||||
SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
|
||||
GROUP BY lock_table;
|
||||
set @old_sql_mode = @@sql_mode;
|
||||
set sql_mode = 'ANSI_QUOTES';
|
||||
--sorted_result
|
||||
SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
|
||||
GROUP BY lock_table;
|
||||
set @@sql_mode = @old_sql_mode;
|
||||
--error ER_LOCK_DEADLOCK
|
||||
UPDATE `t``\""e` SET a = 4 WHERE a = 22;
|
||||
--echo # First table reported in 'SHOW ENGINE InnoDB STATUS'
|
||||
# RECORD LOCKS space id 0 page no 50 n bits 80 index `PRIMARY` in \
|
||||
# Database `test`, Table `t1`, Partition `p0`, Subpartition `sp0` \
|
||||
# trx id 0 775
|
||||
# NOTE: replace_regex is very slow on match copy/past '(.*)' regex's
|
||||
# on big texts, removing a lot of text before + after makes it much faster.
|
||||
#/.*in (.*) trx.*/\1/
|
||||
--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
|
||||
SHOW ENGINE InnoDB STATUS;
|
||||
set @old_sql_mode = @@sql_mode;
|
||||
set sql_mode = 'ANSI_QUOTES';
|
||||
--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
|
||||
SHOW ENGINE InnoDB STATUS;
|
||||
set @@sql_mode = @old_sql_mode;
|
||||
--echo # con1
|
||||
connection con1;
|
||||
REAP;
|
||||
ROLLBACK;
|
||||
disconnect con1;
|
||||
--echo # default connection
|
||||
connection default;
|
||||
DROP TABLE `t``\""e`;
|
||||
SET NAMES DEFAULT;
|
1
mysql-test/t/partition_open_files_limit-master.opt
Normal file
1
mysql-test/t/partition_open_files_limit-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--open-files-limit=5 --max_connections=2 --table_open_cache=1
|
26
mysql-test/t/partition_open_files_limit.test
Normal file
26
mysql-test/t/partition_open_files_limit.test
Normal file
@ -0,0 +1,26 @@
|
||||
--source include/have_partition.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
--enable_warnings
|
||||
|
||||
# On some platforms the lowest possible open_files_limit is too high...
|
||||
let $max_open_files_limit= `SELECT @@open_files_limit > 511`;
|
||||
if ($max_open_files_limit)
|
||||
{
|
||||
skip Need open_files_limit to be lower than 512;
|
||||
}
|
||||
|
||||
#
|
||||
--echo # Bug#46922: crash when adding partitions and open_files_limit is reached
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY)
|
||||
ENGINE=MyISAM PARTITION BY KEY () PARTITIONS 1;
|
||||
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
|
||||
--echo # if the bug exists, then crash will happen here
|
||||
--replace_regex /file '.*'/file '<partition file>'/
|
||||
--error 23
|
||||
ALTER TABLE t1 ADD PARTITION PARTITIONS 511;
|
||||
--sorted_result
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
@ -1046,3 +1046,128 @@ explain select * from t2 where a=1000 and b<11;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug#42846: wrong result returned for range scan when using covering index
|
||||
#
|
||||
CREATE TABLE t1( a INT, b INT, KEY( a, b ) );
|
||||
|
||||
CREATE TABLE t2( a INT, b INT, KEY( a, b ) );
|
||||
|
||||
CREATE TABLE t3( a INT, b INT, KEY( a, b ) );
|
||||
|
||||
INSERT INTO t1( a, b )
|
||||
VALUES (0, 1), (1, 2), (1, 4), (2, 3), (5, 0), (9, 7);
|
||||
|
||||
INSERT INTO t2( a, b )
|
||||
VALUES ( 1, 1), ( 2, 1), ( 3, 1), ( 4, 1), ( 5, 1),
|
||||
( 6, 1), ( 7, 1), ( 8, 1), ( 9, 1), (10, 1),
|
||||
(11, 1), (12, 1), (13, 1), (14, 1), (15, 1),
|
||||
(16, 1), (17, 1), (18, 1), (19, 1), (20, 1);
|
||||
|
||||
INSERT INTO t2 SELECT a, 2 FROM t2 WHERE b = 1;
|
||||
INSERT INTO t2 SELECT a, 3 FROM t2 WHERE b = 1;
|
||||
|
||||
# To make range scan compelling to the optimizer
|
||||
INSERT INTO t2 SELECT -1, -1 FROM t2;
|
||||
INSERT INTO t2 SELECT -1, -1 FROM t2;
|
||||
INSERT INTO t2 SELECT -1, -1 FROM t2;
|
||||
|
||||
INSERT INTO t3
|
||||
VALUES (1, 0), (2, 0), (3, 0), (4, 0), (5, 0),
|
||||
(6, 0), (7, 0), (8, 0), (9, 0), (10, 0);
|
||||
|
||||
# To make range scan compelling to the optimizer
|
||||
INSERT INTO t3 SELECT * FROM t3 WHERE a = 10;
|
||||
INSERT INTO t3 SELECT * FROM t3 WHERE a = 10;
|
||||
|
||||
|
||||
#
|
||||
# Problem#1 Test queries. Will give missing results unless Problem#1 is fixed.
|
||||
# With one exception, they are independent of Problem#2.
|
||||
#
|
||||
SELECT * FROM t1 WHERE
|
||||
3 <= a AND a < 5 OR
|
||||
5 < a AND b = 3 OR
|
||||
3 <= a;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE
|
||||
3 <= a AND a < 5 OR
|
||||
5 < a AND b = 3 OR
|
||||
3 <= a;
|
||||
|
||||
# Query below: Tests both Problem#1 and Problem#2 (EXPLAIN differs as well)
|
||||
SELECT * FROM t1 WHERE
|
||||
3 <= a AND a < 5 OR
|
||||
5 <= a AND b = 3 OR
|
||||
3 <= a;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE
|
||||
3 <= a AND a < 5 OR
|
||||
5 <= a AND b = 3 OR
|
||||
3 <= a;
|
||||
|
||||
SELECT * FROM t1 WHERE
|
||||
3 <= a AND a <= 5 OR
|
||||
5 <= a AND b = 3 OR
|
||||
3 <= a;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE
|
||||
3 <= a AND a <= 5 OR
|
||||
5 <= a AND b = 3 OR
|
||||
3 <= a;
|
||||
|
||||
SELECT * FROM t1 WHERE
|
||||
3 <= a AND a <= 5 OR
|
||||
3 <= a;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE
|
||||
3 <= a AND a <= 5 OR
|
||||
3 <= a;
|
||||
|
||||
#
|
||||
# Problem#2 Test queries.
|
||||
# These queries will give missing results if Problem#1 is fixed.
|
||||
# But Problem#1 also hides this bug.
|
||||
#
|
||||
SELECT * FROM t2 WHERE
|
||||
5 <= a AND a < 10 AND b = 1 OR
|
||||
15 <= a AND a < 20 AND b = 3
|
||||
OR
|
||||
1 <= a AND b = 1;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t2 WHERE
|
||||
5 <= a AND a < 10 AND b = 1 OR
|
||||
15 <= a AND a < 20 AND b = 3
|
||||
OR
|
||||
1 <= a AND b = 1;
|
||||
|
||||
SELECT * FROM t2 WHERE
|
||||
5 <= a AND a < 10 AND b = 2 OR
|
||||
15 <= a AND a < 20 AND b = 3
|
||||
OR
|
||||
1 <= a AND b = 1;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t2 WHERE
|
||||
5 <= a AND a < 10 AND b = 2 OR
|
||||
15 <= a AND a < 20 AND b = 3
|
||||
OR
|
||||
1 <= a AND b = 1;
|
||||
|
||||
SELECT * FROM t3 WHERE
|
||||
5 <= a AND a < 10 AND b = 3 OR
|
||||
a < 5 OR
|
||||
a < 10;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t3 WHERE
|
||||
5 <= a AND a < 10 AND b = 3 OR
|
||||
a < 5 OR
|
||||
a < 10;
|
||||
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
@ -28,5 +28,37 @@ SELECT 1;
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #47106: Crash / segfault on adding EXPLAIN to a non-crashing
|
||||
--echo # query
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a INT,
|
||||
b INT,
|
||||
PRIMARY KEY (a),
|
||||
KEY b (b)
|
||||
);
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 1);
|
||||
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
|
||||
CREATE TABLE t3 LIKE t1;
|
||||
INSERT INTO t3 SELECT * FROM t1;
|
||||
|
||||
--echo # Should not crash.
|
||||
--echo # Should have 1 impossible where and 2 dependent subqs.
|
||||
EXPLAIN
|
||||
SELECT
|
||||
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
|
||||
FROM t3 WHERE 1 = 0 GROUP BY 1;
|
||||
|
||||
--echo # should return 0 rows
|
||||
SELECT
|
||||
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
|
||||
FROM t3 WHERE 1 = 0 GROUP BY 1;
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@ -397,6 +397,17 @@ insert into t2bit7 values (b'110011011111111');
|
||||
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
|
||||
drop table t1bit7, t2bit7;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug42803: Field_bit does not have unsigned_flag field,
|
||||
--echo # can lead to bad memory access
|
||||
--echo #
|
||||
CREATE TABLE t1 (a BIT(7), b BIT(9), KEY(a, b));
|
||||
INSERT INTO t1 VALUES(0, 0), (5, 3), (5, 6), (6, 4), (7, 0);
|
||||
EXPLAIN SELECT a+0, b+0 FROM t1 WHERE a > 4 and b < 7 ORDER BY 2;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
|
@ -1382,6 +1382,127 @@ DROP VIEW test.v3;
|
||||
DROP USER mysqluser1@localhost;
|
||||
USE test;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#35996: SELECT + SHOW VIEW should be enough to display view
|
||||
--echo # definition
|
||||
--echo #
|
||||
-- source include/not_embedded.inc
|
||||
CREATE USER mysqluser1@localhost;
|
||||
CREATE DATABASE mysqltest1;
|
||||
CREATE DATABASE mysqltest2;
|
||||
GRANT USAGE, SELECT, CREATE VIEW, SHOW VIEW
|
||||
ON mysqltest2.* TO mysqluser1@localhost;
|
||||
|
||||
USE mysqltest1;
|
||||
|
||||
CREATE TABLE t1( a INT );
|
||||
CREATE TABLE t2( a INT, b INT );
|
||||
CREATE FUNCTION f1() RETURNS INT RETURN 1;
|
||||
CREATE VIEW v1 AS SELECT 1 AS a;
|
||||
CREATE VIEW v2 AS SELECT 1 AS a, 2 AS b;
|
||||
|
||||
GRANT SELECT ON TABLE t1 TO mysqluser1@localhost;
|
||||
GRANT SELECT (a, b) ON TABLE t2 TO mysqluser1@localhost;
|
||||
GRANT EXECUTE ON FUNCTION f1 TO mysqluser1@localhost;
|
||||
GRANT SELECT ON TABLE v1 TO mysqluser1@localhost;
|
||||
GRANT SELECT (a, b) ON TABLE v2 TO mysqluser1@localhost;
|
||||
|
||||
CREATE VIEW v_t1 AS SELECT * FROM t1;
|
||||
CREATE VIEW v_t2 AS SELECT * FROM t2;
|
||||
CREATE VIEW v_f1 AS SELECT f1() AS a;
|
||||
CREATE VIEW v_v1 AS SELECT * FROM v1;
|
||||
CREATE VIEW v_v2 AS SELECT * FROM v2;
|
||||
|
||||
GRANT SELECT, SHOW VIEW ON v_t1 TO mysqluser1@localhost;
|
||||
GRANT SELECT, SHOW VIEW ON v_t2 TO mysqluser1@localhost;
|
||||
GRANT SELECT, SHOW VIEW ON v_f1 TO mysqluser1@localhost;
|
||||
GRANT SELECT, SHOW VIEW ON v_v1 TO mysqluser1@localhost;
|
||||
GRANT SELECT, SHOW VIEW ON v_v2 TO mysqluser1@localhost;
|
||||
|
||||
--connect (connection1, localhost, mysqluser1,, mysqltest2)
|
||||
CREATE VIEW v_mysqluser1_t1 AS SELECT * FROM mysqltest1.t1;
|
||||
CREATE VIEW v_mysqluser1_t2 AS SELECT * FROM mysqltest1.t2;
|
||||
CREATE VIEW v_mysqluser1_f1 AS SELECT mysqltest1.f1() AS a;
|
||||
CREATE VIEW v_mysqluser1_v1 AS SELECT * FROM mysqltest1.v1;
|
||||
CREATE VIEW v_mysqluser1_v2 AS SELECT * FROM mysqltest1.v2;
|
||||
|
||||
SHOW CREATE VIEW mysqltest1.v_t1;
|
||||
SHOW CREATE VIEW mysqltest1.v_t2;
|
||||
SHOW CREATE VIEW mysqltest1.v_f1;
|
||||
SHOW CREATE VIEW mysqltest1.v_v1;
|
||||
SHOW CREATE VIEW mysqltest1.v_v2;
|
||||
|
||||
SHOW CREATE VIEW v_mysqluser1_t1;
|
||||
SHOW CREATE VIEW v_mysqluser1_t2;
|
||||
SHOW CREATE VIEW v_mysqluser1_f1;
|
||||
SHOW CREATE VIEW v_mysqluser1_v1;
|
||||
SHOW CREATE VIEW v_mysqluser1_v2;
|
||||
|
||||
--connection default
|
||||
REVOKE SELECT ON TABLE t1 FROM mysqluser1@localhost;
|
||||
REVOKE SELECT (a) ON TABLE t2 FROM mysqluser1@localhost;
|
||||
REVOKE EXECUTE ON FUNCTION f1 FROM mysqluser1@localhost;
|
||||
REVOKE SELECT ON TABLE v1 FROM mysqluser1@localhost;
|
||||
|
||||
--connection connection1
|
||||
SHOW CREATE VIEW mysqltest1.v_t1;
|
||||
SHOW CREATE VIEW mysqltest1.v_t2;
|
||||
SHOW CREATE VIEW mysqltest1.v_f1;
|
||||
SHOW CREATE VIEW mysqltest1.v_v1;
|
||||
SHOW CREATE VIEW mysqltest1.v_v2;
|
||||
|
||||
SHOW CREATE VIEW v_mysqluser1_t1;
|
||||
SHOW CREATE VIEW v_mysqluser1_t2;
|
||||
SHOW CREATE VIEW v_mysqluser1_f1;
|
||||
SHOW CREATE VIEW v_mysqluser1_v1;
|
||||
SHOW CREATE VIEW v_mysqluser1_v2;
|
||||
|
||||
--connection default
|
||||
--echo # Testing the case when the views reference missing objects.
|
||||
--echo # Obviously, there are no privileges to check for, so we
|
||||
--echo # need only each object type once.
|
||||
DROP TABLE t1;
|
||||
DROP FUNCTION f1;
|
||||
DROP VIEW v1;
|
||||
|
||||
--connection connection1
|
||||
SHOW CREATE VIEW mysqltest1.v_t1;
|
||||
SHOW CREATE VIEW mysqltest1.v_f1;
|
||||
SHOW CREATE VIEW mysqltest1.v_v1;
|
||||
|
||||
SHOW CREATE VIEW v_mysqluser1_t1;
|
||||
SHOW CREATE VIEW v_mysqluser1_f1;
|
||||
SHOW CREATE VIEW v_mysqluser1_v1;
|
||||
|
||||
--connection default
|
||||
REVOKE SHOW VIEW ON v_t1 FROM mysqluser1@localhost;
|
||||
REVOKE SHOW VIEW ON v_f1 FROM mysqluser1@localhost;
|
||||
REVOKE SHOW VIEW ON v_v1 FROM mysqluser1@localhost;
|
||||
|
||||
--connection connection1
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
SHOW CREATE VIEW mysqltest1.v_t1;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
SHOW CREATE VIEW mysqltest1.v_f1;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
SHOW CREATE VIEW mysqltest1.v_v1;
|
||||
SHOW CREATE VIEW v_mysqluser1_t1;
|
||||
SHOW CREATE VIEW v_mysqluser1_f1;
|
||||
SHOW CREATE VIEW v_mysqluser1_v1;
|
||||
|
||||
--disconnect connection1
|
||||
--connection default
|
||||
DROP USER mysqluser1@localhost;
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP DATABASE mysqltest2;
|
||||
USE test;
|
||||
|
||||
CREATE TABLE t1( a INT );
|
||||
CREATE DEFINER = no_such_user@no_such_host VIEW v1 AS SELECT * FROM t1;
|
||||
SHOW CREATE VIEW v1;
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
|
||||
# Wait till we reached the initial number of concurrent sessions
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
|
@ -92,3 +92,9 @@ execute abc;
|
||||
execute abc;
|
||||
deallocate prepare abc;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#45498: Socket variable not available on Windows
|
||||
--echo #
|
||||
|
||||
SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME = 'socket';
|
||||
|
Reference in New Issue
Block a user