From b229781c2d58603cb39b9e4cee2ba1c20f9d183f Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 11 Nov 2009 12:46:19 +0100 Subject: Bug #48671 mysqltest fails on 'perl' in file sourced inside 'while' Actually, fails on 'perl' in any while Fixed essentially the same way as for append_file --- mysql-test/t/mysqltest.test | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index bcf33aa8c27..b4ea9202df7 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1905,6 +1905,20 @@ perl; print "hello\n"; EOF +# Test perl within while, also with if being false first iteration +let $outer= 3; +let $ifval= 0; +while ($outer) { + if ($ifval) { + perl UNTIL; + my $val= 5; + print "val is $val\n"; +UNTIL + } + inc $ifval; + dec $outer; +} + # ---------------------------------------------------------------------------- # test for die # ---------------------------------------------------------------------------- -- cgit v1.2.1 From a89d88dc0a5db71cb1c748e5fc7b6a570cc5c2ee Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 2 Feb 2010 18:30:23 +0200 Subject: Bug #45989 take 2 : memory leak after explain encounters an error in the query. Fixes a leak after materializing a GROUP BY subquery to a temp table when the subquery has a blob column in the SELECT list. Fixed by correctly destructing temporary buffers for re-usable queries --- mysql-test/t/subselect.test | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 027578fc6bd..09a7ca22e44 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3600,4 +3600,21 @@ SELECT 1 FROM t1 WHERE a <> SOME ); DROP TABLE t1; +--echo # +--echo # Bug #45989 take 2 : memory leak after explain encounters an +--echo # error in the query +--echo # + +CREATE TABLE t1(a LONGTEXT); +INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet)); +INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet)); + +--error ER_BAD_FIELD_ERROR +EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1, +(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1 +WHERE t1.a = d1.a; + +DROP TABLE t1; + + --echo End of 5.1 tests. -- cgit v1.2.1 From 2be07c70947924c9829ad58dd1ee9d1f4228c401 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 5 Feb 2010 13:39:46 +0400 Subject: Bug#47736 killing a select from a view when the view is processing a function, asserts hide_view_error() does not take into account that thread query may be killed. Added a check for thd->killed. Addon: backported bug32140 fix from 6.0 mysql-test/r/sp_notembedded.result: test case mysql-test/t/sp_notembedded.test: test case sql/sp.cc: backported bug32140 fix from 6.0 sql/table.cc: Added a check for thd->killed. --- mysql-test/t/sp_notembedded.test | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test index f593e184ad2..326cc22f1cd 100644 --- a/mysql-test/t/sp_notembedded.test +++ b/mysql-test/t/sp_notembedded.test @@ -413,6 +413,43 @@ let $wait_condition= --source include/wait_condition.inc DROP PROCEDURE p; +# +# Bug#47736 killing a select from a view when the view is processing a function, asserts +# +CREATE TABLE t1(a int); +INSERT INTO t1 VALUES (1); +CREATE FUNCTION f1 (inp TEXT) RETURNS INT NO SQL RETURN sleep(60); +CREATE VIEW v1 AS SELECT f1('a') FROM t1; + +--connect (con1, localhost, root,,) +--let $ID_1= `SELECT connection_id()` +--send SELECT * FROM v1; + +--connect (con2, localhost, root,,) +--let $ID_2= `SELECT connection_id()` +--send SELECT * FROM v1 + +--connection default +--disable_query_log +--eval KILL QUERY $ID_2 +--eval KILL QUERY $ID_1 +--enable_query_log + +--connection con1 +--error ER_QUERY_INTERRUPTED +--reap +--connection con2 +--error ER_QUERY_INTERRUPTED +--reap + +--connection default +DROP VIEW v1; +DROP TABLE t1; +DROP FUNCTION f1; +--disconnect con1 +--disconnect con2 + + --echo # ------------------------------------------------------------------ --echo # -- End of 5.1 tests --echo # ------------------------------------------------------------------ -- cgit v1.2.1 From 6b8ec684c794455f442d45e2086dd3161e9bcde1 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 23 Dec 2009 12:45:18 +0200 Subject: Bug #39022: Mysql randomly crashing in lock_sec_rec_cons_read_sees flush_cached_records() was not correctly checking for errors after calling Item::val_xxx() methods. The expressions may contain subqueries or stored procedures that cause errors that should stop the statement. Fixed by correctly checking for errors and propagating them up the call stack. --- mysql-test/t/bug39022.test | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 mysql-test/t/bug39022.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/bug39022.test b/mysql-test/t/bug39022.test new file mode 100644 index 00000000000..1a1d10f5592 --- /dev/null +++ b/mysql-test/t/bug39022.test @@ -0,0 +1,58 @@ +-- source include/have_log_bin.inc +-- source include/have_innodb.inc + +--echo # +--echo # Bug #39022: Mysql randomly crashing in lock_sec_rec_cons_read_sees +--echo # + +CREATE TABLE t1(a TINYINT NOT NULL,b TINYINT,PRIMARY KEY(b)) ENGINE=innodb; +CREATE TABLE t2(d TINYINT NOT NULL,UNIQUE KEY(d)) ENGINE=innodb; +INSERT INTO t1 VALUES (13,0),(8,1),(9,2),(6,3), +(11,5),(11,6),(7,7),(7,8),(4,9),(6,10),(3,11),(11,12), +(12,13),(7,14); +INSERT INTO t2 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10), +(11),(12),(13),(14); + +connect (thread1, localhost, root,,); +connect (thread2, localhost, root,,); + +connection thread1; +--echo # in thread1 +START TRANSACTION; + +connection thread2; +--echo # in thread2 +REPLACE INTO t2 VALUES (-17); +SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d); + +connection thread1; +--echo # in thread1 +REPLACE INTO t1(a,b) VALUES (67,20); + +connection thread2; +--echo # in thread2 +COMMIT; +START TRANSACTION; +REPLACE INTO t1(a,b) VALUES (65,-50); +REPLACE INTO t2 VALUES (-91); +send; +SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d); #waits + +connection thread1; +--echo # in thread1 + +--echo # should not crash +--error ER_LOCK_DEADLOCK +SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d); #crashes + +connection thread2; +--echo # in thread2 +REAP; + +connection default; +--echo # in default + +disconnect thread1; +disconnect thread2; + +DROP TABLE t1,t2; -- cgit v1.2.1 From 5b66dab00f9f7456632911a41c2b8f701cb21264 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 6 Jan 2010 09:42:21 +0100 Subject: Bug #48863 mysql test: enable and disable case insensitive compare mode Implemented --lowercase_result which lower cases next result --- mysql-test/t/mysqltest.test | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index b4ea9202df7..ce9b31eb30f 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -2059,6 +2059,44 @@ INSERT INTO t1 SELECT f1 - 512 FROM t1; SELECT * FROM t1; --enable_result_log DROP TABLE t1; + +# ---------------------------------------------------------------------------- +# test for lowercase_result +# ---------------------------------------------------------------------------- + +# 1. Basic test +--lowercase_result +SELECT "500g BLÅBÆRSYLTETØY" AS "WILL BE lower cased"; + +# 2. test that it does not apply to next statement +SELECT "UPPER" AS "WILL NOT BE lower cased"; + +# 3. test that it does not affect non-SQL or the following statement +--lowercase_result +--echo UP +SELECT 0 as "UP AGAIN"; + +# 4. test that it works with eval and variables +let $lower_stmt=SELECT "ABCdef" AS "uvwXYZ"; +--lowercase_result +eval $lower_stmt; + +# 5. test that it works in combination with sort +sorted_result; +lowercase_result; +SELECT "Xyz" AS Name UNION SELECT "Abc" as Name ORDER BY Name DESC; + +# 6. Test combination with replace, and that lower casing is done first +--lowercase_result +--replace_result old new +SELECT 1 as "SOME OLD TEXT"; + +# 7. Test missing lower casing of "unknown" characters +--character_set utf8 +--lowercase_result +SELECT 0 as "WILL NOT lower case ÄËÐ"; +--character_set latin1 + # ---------------------------------------------------------------------------- # Some coverage tests # ---------------------------------------------------------------------------- -- cgit v1.2.1 From 04a5dcb136c17e471cbb647c2f45d23682adfea2 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 6 Jan 2010 09:47:25 +0100 Subject: Bug #49761 mysqltest.test does not have any tests for send/reap Added them NB the 6th case is adapted to Bug no. 49269, gives wrong output without it --- mysql-test/t/mysqltest.test | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index ce9b31eb30f..45fc0715312 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1605,6 +1605,57 @@ insert into t1 values (2,4); select * from t1; drop table t1; +# ---------------------------------------------------------------------------- +# Tests of send +# ---------------------------------------------------------------------------- + +create table t1 ( f1 char(10)); +insert into t1 values ("Abcd"); + +# 1. Basic test + +send select * from t1; +reap; + +# 2. Test with error + +--send select * from t2; +--error ER_NO_SUCH_TABLE +--reap + +# 3. test send of next stmt + +--send +select * from t1; +--reap + +# 4. Non-query stmt betwen send and reap allowed + +--send select * from t1; +--sleep 0.05 +--echo Result coming up +--reap + +# 5. Test of send_eval + +--let $my_stmt= select * from t1; +--send_eval $my_stmt +--reap + +# 6. Test that mysqltest does not allow query stmt between send and reap +# Untestable directly as it causes mysqltest to fail + +--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.in +--send select * from t1; +select 1; +--reap +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.in 2>&1 +remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.in; + +drop table t1; + # ---------------------------------------------------------------------------- # test for remove_file # ---------------------------------------------------------------------------- -- cgit v1.2.1 From ed64190b232ed23974bc0dc11e8b586d8bfb6c71 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 6 Jan 2010 12:56:22 +0100 Subject: Bug #49269 mysqltest crashes on 'reap' if query executed after 'send' Small amendment: ignore pending reap when switching connection, add test --- mysql-test/t/mysqltest.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 45fc0715312..f3fea9348e4 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1654,6 +1654,18 @@ EOF --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.in 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.in; +# 7. Test that stmt after send without reap IS allowed +# if we have switched connections + +connect (test_con1,localhost,root,,); +--send select * from t1; +connection default; +select 1; +connection test_con1; +select 2; +disconnect test_con1; +connection default; + drop table t1; # ---------------------------------------------------------------------------- -- cgit v1.2.1 From e1b42965a5e95fd8ff331e5c9b84391688285448 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 7 Jan 2010 11:22:45 +0100 Subject: Bug #49269 mysqltest crashes on 'reap' if query executed after 'send' Undid amendment allowing pending reap after switching connections Moved check for pending reap earlier; failed if running with ps-protocol --- mysql-test/t/mysqltest.test | 12 ------------ mysql-test/t/partition_innodb_semi_consistent.test | 1 + 2 files changed, 1 insertion(+), 12 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index f3fea9348e4..45fc0715312 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1654,18 +1654,6 @@ EOF --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.in 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.in; -# 7. Test that stmt after send without reap IS allowed -# if we have switched connections - -connect (test_con1,localhost,root,,); ---send select * from t1; -connection default; -select 1; -connection test_con1; -select 2; -disconnect test_con1; -connection default; - drop table t1; # ---------------------------------------------------------------------------- diff --git a/mysql-test/t/partition_innodb_semi_consistent.test b/mysql-test/t/partition_innodb_semi_consistent.test index 6a6a7cf958e..2711d79f194 100644 --- a/mysql-test/t/partition_innodb_semi_consistent.test +++ b/mysql-test/t/partition_innodb_semi_consistent.test @@ -187,6 +187,7 @@ SELECT * FROM t1; --echo # Switch to connection con2 connection con2; +reap; SELECT * FROM t1; connection default; -- cgit v1.2.1 From 5ae2eda776477494af7dfe2cad9d50bb4ad8d9eb Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 20 Jan 2010 12:51:18 +0100 Subject: Bug #49837 mysqltest exec cannot handle multi-line command correctly Since the exec command line is passed on externally, it cannot take newlines Simply replace \n with space Now also added test case --- mysql-test/t/mysqltest.test | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 45fc0715312..58f66ac814c 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -605,6 +605,15 @@ echo ; --error 1 --exec echo "--exec " | $MYSQL_TEST 2>&1 +# Multi-line exec +exec $MYSQL + test -e "select 1"; +exec $MYSQL test -e "select + 2"; +let $query = select 3 + as X; +exec $MYSQL test -e "$query"; + # ---------------------------------------------------------------------------- # Test let command # ---------------------------------------------------------------------------- -- cgit v1.2.1 From b554f4c52d072518548f41c609144f98f2fae237 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 20 Jan 2010 12:52:35 +0100 Subject: Bug #48888 mysqltest crashes on --replace_result if 'from' is longer than ~1024 symbols valgrind pointed to a buffer allocated by my_realloc which looked fishy Replaced size with what was probably intended, added test case. Now also fixed line after review comment --- mysql-test/t/mysqltest.test | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 45fc0715312..7f5a46fdcee 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1285,6 +1285,17 @@ select "a" as col1, "c" as col2; --error 1 --exec echo "--replace_column 1 b c " | $MYSQL_TEST 2>&1 +let $long_rep= 1234567890123456789012345678901234567890; +let $long_rep= $long_rep,$long_rep; +let $long_rep= $long_rep,$long_rep; +let $long_rep= $long_rep,$long_rep; +let $long_rep= $long_rep,$long_rep; +let $long_rep= $long_rep,$long_rep; + +# This tests from strings > 1024 (here 1311) + +--replace_result $long_rep LONG_STRING +eval select "$long_rep" as x; # ---------------------------------------------------------------------------- # Test sync_with_master -- cgit v1.2.1 From 94ccc34537d1e9ed75a4941773d84230ec4f7ee2 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 20 Jan 2010 14:18:27 +0100 Subject: Bug #49878 delimiter under false 'if' makes mysqltest test fail with 'Missing end of block' delimiter not executed so does not recognize end of block Always execute delimiter command, revert after false if() block. --- mysql-test/t/mysqltest.test | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 45fc0715312..63e15a84a72 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1006,6 +1006,37 @@ echo test3stop --delimiter ; echo test4; +# ---------------------------------------------------------------------------- +# Test that delimiter within if() works in in various combinations +# ---------------------------------------------------------------------------- + +if (0) +{ + delimiter ||; + echo false-inner|| + if (0) + { + delimiter *|| + echo false-innerer* + delimiter ||* + } + echo false-inner again|| +} +echo outer; +if (1) +{ + delimiter /; + echo true-inner/ + if (0) + { + delimiter %/ + echo true-innerer% + } + echo true-inner again/ +} +echo true-outer/ +delimiter ;/ + # ---------------------------------------------------------------------------- # Test if -- cgit v1.2.1 From 630fa243c9a459526e225acc19fee30f4676a505 Mon Sep 17 00:00:00 2001 From: Martin Hansson Date: Wed, 10 Feb 2010 15:37:34 +0100 Subject: Bug#49534: multitable IGNORE update with sql_safe_updates error causes debug assertion The IGNORE option of the multiple-table UPDATE command was not intended to suppress errors caused by the sql_safe_updates mode. This flag will raise an error if the execution of UPDATE does not use a key for row retrieval, and should continue do so regardless of the IGNORE option. However the implementation of IGNORE does not support exceptions to the rule; it always converts errors to warnings and cannot be extended. The Internal_error_handler interface offers the infrastructure to handle individual errors, making sure that the error raised by sql_safe_updates is not silenced. Fixed by implementing an Internal_error_handler and using it for UPDATE IGNORE commands. --- mysql-test/t/multi_update.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index fc37fd6a27d..3c33a3dde35 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -637,5 +637,17 @@ drop table t1, t2, t3; # Add further tests from here # +--echo # +--echo # Bug#49534: multitable IGNORE update with sql_safe_updates error +--echo # causes debug assertion +--echo # +CREATE TABLE t1( a INT, KEY( a ) ); +INSERT INTO t1 VALUES (1), (2), (3); +SET SESSION sql_safe_updates = 1; +--echo # Must not cause failed assertion +--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE +UPDATE IGNORE t1, t1 t1a SET t1.a = 1 WHERE t1a.a = 1; +DROP TABLE t1; + --echo end of tests -- cgit v1.2.1 From ee66332ce43f5aa05b9957ead4bc8dc9b540695e Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Wed, 27 Jan 2010 11:10:53 -0200 Subject: Bug#47734: Assertion failed: ! is_set() when locking a view with non-existing definer The problem was that a failure to open a view wasn't being properly handled. When opening a view with unknown definer, the open procedure would be treated as successful and would later crash when attempting to lock the view (which wasn't opened to begin with). The solution is to skip further processing when opening a table if it fails with a fatal error. mysql-test/r/view.result: Add test case result for Bug#47734. mysql-test/t/view.test: Add test case for Bug#47734. sql/sql_base.cc: Skip further processing if opening a table failed due to a fatal error (for the statement). --- mysql-test/t/view.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index a788b5ab41e..c0cdd40ddb6 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3869,6 +3869,18 @@ ALTER TABLE v1; DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # Bug#47734: Assertion failed: ! is_set() when locking a view with non-existing definer +--echo # + +--disable_warnings +DROP VIEW IF EXISTS v1; +--enable_warnings + +CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1; +--error ER_NO_SUCH_USER +LOCK TABLES v1 READ; +DROP VIEW v1; --echo # ----------------------------------------------------------------- --echo # -- End of 5.1 tests. -- cgit v1.2.1 From 63817720b41a9daa5d792d517c58ae29130cc254 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Wed, 10 Feb 2010 16:11:08 -0200 Subject: Bug#48449: hang on show create view after upgrading when view contains function of view SHOW CREATE TABLE on a view (v1) that contains a function whose statement uses another view (v2), could trigger a infinite loop if the view referenced within the function causes a warning to be raised while opening the said view (v2). The problem was a infinite loop over the stack of internal error handlers. The problem would be triggered if the stack contained two or more handlers and the first two handlers didn't handle the raised condition. In this case, the loop variable would always point to the second handler in the stack. The solution is to correct the loop variable assignment so that the loop is able to iterate over all handlers in the stack. mysql-test/r/view.result: Add test case result for Bug#48449. mysql-test/std_data/bug48449.frm: Add a incomplete view definition that causes a warning to be issued. mysql-test/t/view.test: Add test case for Bug#48449 sql/sql_class.cc: Iterate over all handlers in the stack. --- mysql-test/t/view.test | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index c0cdd40ddb6..01fa5bc53df 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3882,6 +3882,40 @@ CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1; LOCK TABLES v1 READ; DROP VIEW v1; +--echo # +--echo # Bug#48449: hang on show create view after upgrading when +--echo # view contains function of view +--echo # + +--disable_warnings +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); + +delimiter //; +CREATE FUNCTION f1() RETURNS INT +BEGIN + SELECT a FROM v2 INTO @a; + RETURN @a; +END// +delimiter ;// + +--echo # Trigger pre-locking when opening v2. +CREATE VIEW v1 AS SELECT f1() FROM t1; + +let $MYSQLD_DATADIR= `SELECT @@datadir`; +copy_file std_data/bug48449.frm $MYSQLD_DATADIR/test/v2.frm; + +SHOW CREATE VIEW v1; + +DROP VIEW v1,v2; +DROP TABLE t1,t2; +DROP FUNCTION f1; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.1 tests. --echo # ----------------------------------------------------------------- -- cgit v1.2.1 From 80164ae9a08041e67c65460d9bb2a6b0e1aeb277 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 12 Feb 2010 00:54:14 -0200 Subject: Move test case. Embedded server does not support privilege related bits. --- mysql-test/t/view.test | 13 ------------- mysql-test/t/view_grant.test | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 01fa5bc53df..1165c68494b 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3869,19 +3869,6 @@ ALTER TABLE v1; DROP VIEW v1; DROP TABLE t1; ---echo # ---echo # Bug#47734: Assertion failed: ! is_set() when locking a view with non-existing definer ---echo # - ---disable_warnings -DROP VIEW IF EXISTS v1; ---enable_warnings - -CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1; ---error ER_NO_SUCH_USER -LOCK TABLES v1 READ; -DROP VIEW v1; - --echo # --echo # Bug#48449: hang on show create view after upgrading when --echo # view contains function of view diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test index 175468db702..ba603bde7f8 100644 --- a/mysql-test/t/view_grant.test +++ b/mysql-test/t/view_grant.test @@ -1532,3 +1532,17 @@ SELECT a FROM v2; --disconnect mysqluser1 DROP USER mysqluser1; DROP DATABASE mysqltest1; +USE test; + +--echo # +--echo # Bug#47734: Assertion failed: ! is_set() when locking a view with non-existing definer +--echo # + +--disable_warnings +DROP VIEW IF EXISTS v1; +--enable_warnings + +CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1; +--error ER_NO_SUCH_USER +LOCK TABLES v1 READ; +DROP VIEW v1; -- cgit v1.2.1 From 46cffd7f5b585527387e2a23d1c3c43d2b14bf2c Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 12 Feb 2010 13:44:20 +0400 Subject: Bug#48294 assertion when creating a view based on some row() construct in select query In case of 'CREATE VIEW' subselect transformation does not happen(see JOIN::prepare). During fix_fields Item_row may call is_null() method for its arugmens which leads to item calculation(wrong subselect in our case as transformation did not happen before). This is_null() call does not make sence for 'CREATE VIEW'. Note: Only Item_row is affected because other items don't call is_null() during fix_fields() for arguments. mysql-test/r/view.result: test case mysql-test/t/view.test: test case sql/item_row.cc: skip is_null() call in case of 'CREATE VIEW' as unnecessary. --- mysql-test/t/view.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 1165c68494b..1d0796469f2 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3903,6 +3903,19 @@ DROP VIEW v1,v2; DROP TABLE t1,t2; DROP FUNCTION f1; + +# +# Bug#48294 assertion when creating a view based on some row() construct in select query +# +CREATE TABLE t1(f1 INT); +INSERT INTO t1 VALUES (); + +CREATE VIEW v1 AS SELECT 1 FROM t1 WHERE +ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' ))); + +DROP VIEW v1; +DROP TABLE t1; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.1 tests. --echo # ----------------------------------------------------------------- -- cgit v1.2.1 From 9d0c1ce535b57d97cb41dfca47aa33608c38b62d Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 12 Feb 2010 15:28:38 +0400 Subject: BUG#48438 - crash with error in unioned query against merge table and view... Invalid memory reads after a query referencing MyISAM table multiple times with write lock. Invalid memory reads may lead to server crash, valgrind warnings, incorrect values in INFORMATION_SCHEMA.TABLES.{TABLE_ROWS, DATA_LENGTH, INDEX_LENGTH, ...}. This may happen when one of the table instances gets closed after a query, e.g. out of slots in open tables cache. UNION, MERGE and VIEW are irrelevant. The problem was that MyISAM didn't restore state info pointer to default value. myisam/mi_locking.c: When a query is referencing MyISAM table multiple times with a write lock, all table instances share the same state info, pointing to MI_INFO::save_state of "primary" table instance. When lock is released, state pointer was restored only for the primary table instance. Secondary table instances are still pointing to save_state of primary table instance. Primary table instance may get closed, leaving secondary table instances state pointer pointing to freed memory. That's mostly ok, since next lock will update state info pointer to correct value. But there're some cases, when this secondary table instance state info is accessed without a lock, e.g. INFORMATION_SCHEMA, MERGE (in 5.1 and up), MyISAM itself for DBUG purposes. Restore default value of state pointer unconditionally, for both primary and secondary table instances. mysql-test/r/myisam.result: A test case for BUG#48438. mysql-test/t/myisam.test: A test case for BUG#48438. --- mysql-test/t/myisam.test | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index d0a480348a3..936c47a6d08 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1239,4 +1239,15 @@ CHECKSUM TABLE t1 EXTENDED; DROP TABLE t1; +--echo # +--echo # BUG#48438 - crash with error in unioned query against merge table and view... +--echo # +SET GLOBAL table_cache=3; +CREATE TABLE t1(a INT); +SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4 FOR UPDATE; +SELECT TABLE_ROWS, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; +DROP TABLE t1; +SET GLOBAL table_cache=DEFAULT; + --echo End of 5.0 tests -- cgit v1.2.1 From 62933c50df1dd97940f4b46c1376ba80e6a8368c Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 12 Feb 2010 16:30:04 +0400 Subject: BUG#49628 - corrupt table after legal SQL, LONGTEXT column Bulk REPLACE or bulk INSERT ... ON DUPLICATE KEY UPDATE may break dynamic record MyISAM table. The problem is limited to bulk REPLACE and INSERT ... ON DUPLICATE KEY UPDATE, because only these operations may be done via UPDATE internally and may request write cache. When flushing write cache, MyISAM may write remaining cached data at wrong position. Fixed by requesting write cache to seek to a correct position. mysql-test/r/myisam.result: A test case for BUG#49628. mysql-test/t/myisam.test: A test case for BUG#49628. storage/myisam/mi_dynrec.c: delete_dynamic_record() may change data file position. IO cache must be notified as it may still have cached data, which has to be flushed later. --- mysql-test/t/myisam.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 351027ab246..568eadb5e39 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1563,5 +1563,18 @@ SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; CHECK TABLE t1; DROP TABLE t1; + +--echo # +--echo # BUG#49628 - corrupt table after legal SQL, LONGTEXT column +--echo # +CREATE TABLE t1(a INT, b LONGTEXT, UNIQUE(a)); +REPLACE INTO t1 VALUES +(1, REPEAT('a', 129015)),(1, NULL), +(2, NULL),(3, NULL),(4, NULL),(5, NULL),(6, NULL),(7, NULL), +(1, REPEAT('b', 129016)),(1, NULL), +(1, REPEAT('c', 129015)),(1, REPEAT('d', 129015)); +CHECK TABLE t1; +DROP TABLE t1; + --echo End of 5.1 tests -- cgit v1.2.1 From 91f0212c68662f57d922e61ce3f5a5defd697949 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 12 Feb 2010 16:33:03 +0400 Subject: BUG#48757 - missing .ARZ file causes server crash Server crashes when accessing ARCHIVE table with missing .ARZ file. When opening a table, ARCHIVE didn't properly pass through error code from lower level azopen() to higher level open() method. mysql-test/r/archive.result: A test case for BUG#48757. mysql-test/t/archive.test: A test case for BUG#48757. storage/archive/ha_archive.cc: Pass through error code from azopen(). --- mysql-test/t/archive.test | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index 90f5b1b0b53..67ad0517ed2 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1644,3 +1644,14 @@ INSERT INTO t1 (col1, col2) VALUES (1, "value"); REPAIR TABLE t1; DROP TABLE t1; remove_file $MYSQLD_DATADIR/test/t1.ARM; + +--echo # +--echo # BUG#48757 - missing .ARZ file causes server crash +--echo # +CREATE TABLE t1(a INT) ENGINE=ARCHIVE; +FLUSH TABLE t1; +--remove_file $MYSQLD_DATADIR/test/t1.ARZ +--error ER_FILE_NOT_FOUND +SELECT * FROM t1; +--error ER_BAD_TABLE_ERROR +DROP TABLE t1; -- cgit v1.2.1 From d6ab925c5e10acc72cddbaf910d9aa4bee305c82 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 28 Jan 2010 12:41:14 -0200 Subject: Bug#50423: Crash on second call of a procedure dropping a trigger The problem was that a DROP TRIGGER statement inside a stored procedure could cause a crash in subsequent invocations. This was due to the addition, on the first execution, of a temporary table reference to the stored procedure query table list. In a subsequent invocation, there would be a attempt to reinitialize the temporary table reference, which by then was already gone. The solution is to backup and reset the query table list each time a trigger needs to be dropped. This ensures that any temp changes to the query table list are discarded. It is safe to do so at this time as drop trigger is restricted from more complicated scenarios (ie, not allowed within stored functions, etc). mysql-test/r/sp-bugs.result: Add test case result for Bug#50423 mysql-test/t/sp-bugs.test: Add test case for Bug#50423 sql/sql_trigger.cc: Backup and reset the query table list. Remove now unnecessary manual reset of the query table list. --- mysql-test/t/sp-bugs.test | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/sp-bugs.test b/mysql-test/t/sp-bugs.test index 7b94e65a5e9..1eb283f7874 100644 --- a/mysql-test/t/sp-bugs.test +++ b/mysql-test/t/sp-bugs.test @@ -57,5 +57,27 @@ SELECT f2 (); DROP SCHEMA testdb; +USE test; + +--echo # +--echo # Bug#50423: Crash on second call of a procedure dropping a trigger +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TRIGGER IF EXISTS tr1; +DROP PROCEDURE IF EXISTS p1; +--enable_warnings + +CREATE TABLE t1 (f1 INTEGER); +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1; +CREATE PROCEDURE p1 () DROP TRIGGER tr1; + +CALL p1 (); +--error ER_TRG_DOES_NOT_EXIST +CALL p1 (); + +DROP TABLE t1; +DROP PROCEDURE p1; --echo End of 5.1 tests -- cgit v1.2.1 From 6d38c898a6c69c2c7f862d40a323f7feec8934d5 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 29 Jan 2010 17:04:37 +0200 Subject: Bug #49324: more valgrind errors in test_if_skip_sort_order Fixed 2 problems : 1. test_if_order_by_key() was continuing on the primary key as if it has a primary key suffix (as the secondary keys do). This leads to crashes in ORDER BY ,. Fixed by not treating the primary key as the secondary one and not depending on it being clustered with a primary key. 2. The cost calculation was trying to read the records per key when operating on ORDER BYs that order on all of the secondary key + some of the primary key. This leads to crashes because of out-of-bounds array access. Fixed by assuming we'll find 1 record per key in such cases. --- mysql-test/t/innodb_mysql.test | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index a2a1113598d..d9fecccfbdc 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -536,4 +536,14 @@ DROP PROCEDURE p1; DROP VIEW v1; DROP TABLE t1,t2; + +--echo # +--echo # Bug #49324: more valgrind errors in test_if_skip_sort_order +--echo # +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb ; +--echo #should not cause valgrind warnings +SELECT 1 FROM t1 JOIN t1 a USING(a) GROUP BY t1.a,t1.a; +DROP TABLE t1; + + --echo End of 5.1 tests -- cgit v1.2.1 From 16c8298a85619674f1cce46c081e52f4fbeadb33 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Mon, 1 Feb 2010 16:07:00 +0100 Subject: Bug#42438: Crash ha_partition::change_table_ptr There was two problems: The first was the symptom, caused by bad error handling in ha_partition. It did not handle print_error etc. when having no partitions (when used by dummy handler). The second was the real problem that when dropping tables it reused the table type (storage engine) from when the lock was asked for, not the table type that it had when gaining the exclusive name lock. So that it tried to delete tables from wrong storage engines. Solutions for the first problem was to accept some handler calls to the partitioning handler even if it was not setup with any partitions, and also if possible fallback to use the base handler's default functions. Solution for the second problem was to remove the optimization to reuse the definition from the cache, instead always check the frm-file when holding the LOCK_open mutex (updated with a fix for a debug print crash and better comments as required by reviewer, and removed optimization to avoid reading the frm-file). mysql-test/r/partition_debug_sync.result: Bug#42438: Crash ha_partition::change_table_ptr New result file using DEBUG_SYNC for deterministic results. mysql-test/t/partition_debug_sync.test: Bug#42438: Crash ha_partition::change_table_ptr New test file using DEBUG_SYNC for deterministic results. sql/ha_partition.cc: Bug#42438: Crash ha_partition::change_table_ptr allow some handler calls, used by error handling, even when no partitions are setup. Fallback to default handling if possible. sql/sql_base.cc: Bug#42438: Crash ha_partition::change_table_ptr Added DEBUG_SYNC point for deterministic test cases. sql/sql_table.cc: Bug#42438: Crash ha_partition::change_table_ptr Always use the table type written in the .frm-file (i.e. the current table type) when deleting a table. Moved the check for log-table to not depend of the cache. Added DEBUG_SYNC points for deterministic test cases. --- mysql-test/t/partition_debug_sync.test | 81 ++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 mysql-test/t/partition_debug_sync.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/partition_debug_sync.test b/mysql-test/t/partition_debug_sync.test new file mode 100644 index 00000000000..69bc86a8bb7 --- /dev/null +++ b/mysql-test/t/partition_debug_sync.test @@ -0,0 +1,81 @@ +#--disable_abort_on_error +# +# Test for the partition storage engine which require DEBUG_SYNC feature to +# Created by Mattias Jonsson +# +--source include/have_partition.inc +--source include/have_debug_sync.inc + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +SET DEBUG_SYNC= 'RESET'; +--enable_warnings + +--echo # +--echo # Bug#42438: Crash ha_partition::change_table_ptr +--echo # Test when remove partitioning is done while drop table is waiting +--echo # for the table. +connect(con1, localhost, root,,); +--echo # Con 1 +SET DEBUG_SYNC= 'RESET'; +CREATE TABLE t1 +(a INTEGER, + b INTEGER NOT NULL, + KEY (b)) +ENGINE = MYISAM +/*!50100 PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN (2), + PARTITION p1 VALUES LESS THAN (20), + PARTITION p2 VALUES LESS THAN (100), + PARTITION p3 VALUES LESS THAN MAXVALUE ) */; +SET DEBUG_SYNC= 'alter_table_before_create_table_no_lock SIGNAL removing_partitioning WAIT_FOR waiting_for_alter'; +SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL partitioning_removed'; +--send ALTER TABLE t1 REMOVE PARTITIONING +connection default; +--echo # Con default +SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning'; +SET DEBUG_SYNC= 'waiting_for_table SIGNAL waiting_for_alter'; +SET DEBUG_SYNC= 'rm_table_part2_before_delete_table WAIT_FOR partitioning_removed'; +DROP TABLE IF EXISTS t1; +--echo # Con 1 +connection con1; +--reap +connection default; +SET DEBUG_SYNC= 'RESET'; +connection con1; +SET DEBUG_SYNC= 'RESET'; + +--echo # +--echo # Bug#42438: Crash ha_partition::change_table_ptr +--echo # Test when remove partitioning is failing due to drop table is already +--echo # in progress. +CREATE TABLE t2 +(a INTEGER, + b INTEGER NOT NULL, + KEY (b)) +ENGINE = MYISAM +/*!50100 PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN (2), + PARTITION p1 VALUES LESS THAN (20), + PARTITION p2 VALUES LESS THAN (100), + PARTITION p3 VALUES LESS THAN MAXVALUE ) */; +SET DEBUG_SYNC= 'before_lock_tables_takes_lock SIGNAL removing_partitions WAIT_FOR waiting_for_alter'; +SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done'; +--send ALTER TABLE t2 REMOVE PARTITIONING +connection default; +--echo # Con default +SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions'; +SET DEBUG_SYNC= 'waiting_for_table SIGNAL waiting_for_alter'; +SET DEBUG_SYNC= 'rm_table_part2_before_binlog SIGNAL delete_done'; +DROP TABLE IF EXISTS t2; +--echo # Con 1 +connection con1; +--error ER_NO_SUCH_TABLE +--reap +SET DEBUG_SYNC= 'RESET'; +disconnect con1; +connection default; +--echo # Con default +SET DEBUG_SYNC= 'RESET'; + +--echo End of 5.1 tests -- cgit v1.2.1 From dac9e51811a6c4cee0a4ab127f4d264d80a07962 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Tue, 2 Feb 2010 15:08:49 +0400 Subject: BUG#50351 - ft_min_word_len=2 Causes query to hang Performing fulltext prefix search (a word with truncation operator) may cause a dead-loop. ft_min_word_len value doesn't matter actually. The problem was introduced along with "smarter index merge" optimization. mysql-test/r/fulltext.result: A test case for BUG#50351. mysql-test/t/fulltext.test: A test case for BUG#50351. storage/myisam/ft_boolean_search.c: When going up to first-level tree, we need to restore docid[0], so it informs fulltext index merge not to enter this second-level tree again (avoiding dead-loop). --- mysql-test/t/fulltext.test | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 3853a224fd5..705d6478fed 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -544,5 +544,26 @@ SELECT count(*) FROM t1 WHERE DROP TABLE t1,t2,t3; +# +# BUG#50351 - ft_min_word_len=2 Causes query to hang +# +CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a)); +INSERT INTO t1 VALUES +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('awrd'),('cwrd'), +('awrd'); +SELECT COUNT(*) FROM t1 WHERE MATCH(a) AGAINST("+awrd bwrd* +cwrd*" IN BOOLEAN MODE); +DROP TABLE t1; --echo End of 5.1 tests -- cgit v1.2.1 From 01c0d46af876746d738338f9c077e4146f5e81fa Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 4 Feb 2010 13:15:42 +0100 Subject: Bug #39774 mysql-test-run's remove_file can't use wildcards, this should be documented Added remove_files_wildcard that allows to remove multiple files at once. This is a port of original patch to Windows. --- mysql-test/t/mysqltest.test | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 748f31bb5a3..20b35d41515 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1717,6 +1717,19 @@ drop table t1; --error 1 remove_file non_existing_file; +# ---------------------------------------------------------------------------- +# test for remove_files_wildcard +# ---------------------------------------------------------------------------- + +--error 1 +--exec echo "remove_files_wildcard ;" | $MYSQL_TEST 2>&1 + +--error 1 +remove_files_wildcard non_existing_dir; + +--error 1 +remove_files_wildcard non_existing_dir non_existing_file; + # ---------------------------------------------------------------------------- # test for write_file # ---------------------------------------------------------------------------- @@ -2384,9 +2397,14 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir; cat_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt; -remove_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt; -remove_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt; -remove_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt; +list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file11.txt $MYSQLTEST_VARDIR/tmp/testdir file?.txt; +remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir file?.txt; +list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/dir-list.txt $MYSQLTEST_VARDIR/tmp/testdir file*.txt; +cat_file $MYSQLTEST_VARDIR/tmp/testdir/dir-list.txt; +remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir file*.txt; +list_files $MYSQLTEST_VARDIR/tmp/testdir; +remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir; +list_files $MYSQLTEST_VARDIR/tmp/testdir; rmdir $MYSQLTEST_VARDIR/tmp/testdir; # -- cgit v1.2.1 From 3ad5d21ebc981a0b8c59597f0f1a306f3c9d6bf2 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Fri, 5 Feb 2010 17:51:55 +0000 Subject: BUG#50780: 'show binary logs' debug assertion when binary logging is disabled The server would hit an assertion because of a DBUG violation. There was a missing DBUG_RETURN and instead a plain return was used. This patch replaces the return with DBUG_RETURN. --- mysql-test/t/no_binlog.test | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 mysql-test/t/no_binlog.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/no_binlog.test b/mysql-test/t/no_binlog.test new file mode 100644 index 00000000000..628a4ab8351 --- /dev/null +++ b/mysql-test/t/no_binlog.test @@ -0,0 +1,4 @@ +# BUG#50780: 'show binary logs' debug assertion when binary logging is disabled + +-- error ER_NO_BINARY_LOGGING +SHOW BINARY LOGS; -- cgit v1.2.1 From 994c0f83083ceee30430f28b8f1ced9b71944dbb Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Sat, 6 Feb 2010 23:54:30 +0400 Subject: Bug #45640: optimizer bug produces wrong results Grouping by a subquery in a query with a distinct aggregate function lead to a wrong result (wrong and unordered grouping values). There are two related problems: 1) The query like this: SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) c FROM t1 GROUP BY aa returned wrong result, because the outer reference "t1.a" in the subquery was substituted with the Item_ref item. The Item_ref item obtains data from the result_field object that refreshes once after the end of each group. This data is not applicable to filesort since filesort() doesn't care about groups (and doesn't update result_field objects with copy_fields() and so on). Also that data is not applicable to group separation algorithm: end_send_group() checks every record with test_if_group_changed() that evaluates Item_ref items, but it refreshes those Item_ref-s only after the end of group, that is a vicious circle and the grouped column values in the output are shifted. Fix: if a) we grouping by a subquery and b) that subquery has outer references to FROM list of the grouping query, then we substitute these outer references with Item_direct_ref like references under aggregate functions: Item_direct_ref obtains data directly from the current record. 2) The query with a non-trivial grouping expression like: SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) c FROM t1 GROUP BY aa+0 also returned wrong result, since JOIN::exec() substitutes references to top-level aliases in SELECT list with Item_copy caching items. Item_copy items have same refreshing policy as Item_ref items, so the whole groping expression with Item_copy inside returns wrong result in filesort() and end_send_group(). Fix: include aliased items into GROUP BY item tree instead of Item_ref references to them. mysql-test/r/group_by.result: Test case for bug #45640 mysql-test/t/group_by.test: Test case for bug #45640 sql/item.cc: Bug #45640: optimizer bug produces wrong results Item_field::fix_fields() has been modified to resolve aliases in GROUP BY item trees into aliased items instead of Item_ref items. sql/item.h: Bug #45640: optimizer bug produces wrong results - Item::find_item_processor() has been introduced. - Item_ref::walk() has been modified to apply processors to itself too (not only to referenced item). sql/mysql_priv.h: Bug #45640: optimizer bug produces wrong results fix_inner_refs() has been modified to accept group_list parameter. sql/sql_lex.cc: Bug #45640: optimizer bug produces wrong results Initialization of st_select_lex::group_fix_field has been added. sql/sql_lex.h: Bug #45640: optimizer bug produces wrong results The st_select_lex::group_fix_field field has been introduced to control alias resolution in Itef_fied::fix_fields. sql/sql_select.cc: Bug #45640: optimizer bug produces wrong results - The fix_inner_refs function has been modified to treat subquery outer references like outer fields under aggregate functions, if they are included in GROUP BY item tree. - The find_order_in_list function has been modified to fix Item_field alias fields included in the GROUP BY item trees in a special manner. --- mysql-test/t/group_by.test | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 5b96213034a..e6ea5ecc7f6 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1158,3 +1158,53 @@ SELECT COUNT(i) FROM t1 WHERE i > 1; DROP TABLE t1; SET @@sql_mode = @old_sql_mode; +--echo # +--echo # Bug #45640: optimizer bug produces wrong results +--echo # + +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (4, 40), (1, 10), (2, 20), (2, 20), (3, 30); + +--echo # should return 4 ordered records: +SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa; + +SELECT (SELECT (SELECT t1.a)) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa; + +SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa+0; + +--echo # should return the same result in a reverse order: +SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY -aa; + +--echo # execution plan should not use temporary table: +EXPLAIN EXTENDED +SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa+0; + +EXPLAIN EXTENDED +SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY -aa; + +--echo # should return only one record +SELECT (SELECT tt.a FROM t1 tt LIMIT 1) aa, COUNT(DISTINCT b) FROM t1 + GROUP BY aa; + +CREATE TABLE t2 SELECT DISTINCT a FROM t1; + +--echo # originally reported queries (1st two columns of next two query +--echo # results should be same): + +SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT(DISTINCT b) + FROM t1 GROUP BY aa, b; +SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT( b) + FROM t1 GROUP BY aa, b; + +--echo # ORDER BY for sure: + +SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT(DISTINCT b) + FROM t1 GROUP BY aa, b ORDER BY -aa, -b; +SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT( b) + FROM t1 GROUP BY aa, b ORDER BY -aa, -b; + +DROP TABLE t1, t2; + +--echo # + +--echo # End of 5.1 tests -- cgit v1.2.1 From 6124451d9534b1a03e58724411c492d9de980cb4 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Sun, 7 Feb 2010 00:12:04 +0000 Subject: BUG#50780: 'show binary logs' debug assertion when binary logging is disabled Post-push fix: disabling test when running mysqld in embedded mode. --- mysql-test/t/no_binlog.test | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/no_binlog.test b/mysql-test/t/no_binlog.test index 628a4ab8351..fa9c87079de 100644 --- a/mysql-test/t/no_binlog.test +++ b/mysql-test/t/no_binlog.test @@ -1,3 +1,5 @@ +-- source include/not_embedded.inc + # BUG#50780: 'show binary logs' debug assertion when binary logging is disabled -- error ER_NO_BINARY_LOGGING -- cgit v1.2.1 From 0897669cba1b314c36f41a8a31ee73b6d0d11115 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Tue, 9 Feb 2010 12:53:13 +0400 Subject: BUG#49902 - SELECT returns incorrect results Queries optimized with GROUP_MIN_MAX didn't cleanup KEYREAD optimization properly. As a result subsequent queries may return incomplete rows (fields are initialized to default values). mysql-test/r/group_min_max.result: A test case for BUG#49902. mysql-test/t/group_min_max.test: A test case for BUG#49902. sql/opt_range.cc: Refactor of KEYREAD optimization switch so that KEYREAD handler state is in sync with st_table::key_read flag. All SQL code is supposed to switch KEYREAD optimization via st_table::set_keyread(). sql/opt_sum.cc: Refactor of KEYREAD optimization switch so that KEYREAD handler state is in sync with st_table::key_read flag. All SQL code is supposed to switch KEYREAD optimization via st_table::set_keyread(). sql/sql_select.cc: Refactor of KEYREAD optimization switch so that KEYREAD handler state is in sync with st_table::key_read flag. All SQL code is supposed to switch KEYREAD optimization via st_table::set_keyread(). sql/sql_update.cc: Refactor of KEYREAD optimization switch so that KEYREAD handler state is in sync with st_table::key_read flag. All SQL code is supposed to switch KEYREAD optimization via st_table::set_keyread(). sql/table.cc: Refactor of KEYREAD optimization switch so that KEYREAD handler state is in sync with st_table::key_read flag. All SQL code is supposed to switch KEYREAD optimization via st_table::set_keyread(). sql/table.h: Refactor of KEYREAD optimization switch so that KEYREAD handler state is in sync with st_table::key_read flag. All SQL code is supposed to switch KEYREAD optimization via st_table::set_keyread(). --- mysql-test/t/group_min_max.test | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index f623df372fa..df385dfa7d2 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -1044,4 +1044,14 @@ SELECT a, MAX(b) FROM t WHERE b GROUP BY a; DROP TABLE t; +# +# BUG#49902 - SELECT returns incorrect results +# +CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL, KEY (b)); +INSERT INTO t1 VALUES(1,1),(2,1); +ANALYZE TABLE t1; +SELECT 1 AS c, b FROM t1 WHERE b IN (1,2) GROUP BY c, b; +SELECT a FROM t1 WHERE b=1; +DROP TABLE t1; + --echo End of 5.1 tests -- cgit v1.2.1 From 0ad9a5992d0832b07beaa5326d4d53e36669184d Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 9 Feb 2010 18:13:57 +0100 Subject: Bug #50618 Please allow 'sleep $variable' in mtr Made mtr's sleep function understand $variables A few fixes since previous patch, added tests --- mysql-test/t/mysqltest.test | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 20b35d41515..25293ff29e7 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -920,6 +920,28 @@ sleep 0.5; sleep 1; real_sleep 1; +# Parameter from variable, legal and illegal +let $sleep_var= 0.1; +sleep $sleep_var; +let $sleep_var= 1; +--real_sleep $sleep_var + +--write_file $MYSQL_TMP_DIR/sleep.inc +let $sleep_var= xyz; +--sleep $sleep_var +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQL_TMP_DIR/sleep.inc 2>&1 +--remove_file $MYSQL_TMP_DIR/sleep.inc + +--write_file $MYSQL_TMP_DIR/sleep.inc +let $sleep_var= xyz; +real_sleep $sleep_var; +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQL_TMP_DIR/sleep.inc 2>&1 +--remove_file $MYSQL_TMP_DIR/sleep.inc + # Missing parameter --error 1 --exec echo "sleep ;" | $MYSQL_TEST 2>&1 -- cgit v1.2.1 From f2aee2371ef3f9140fb4f812ca7dcdcf2f6720bb Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 10 Feb 2010 18:56:47 +0400 Subject: Bug#45195 valgrind warnings about uninitialized values in store_record_in_cache() The problem becomes apparent only if HAVE_purify is undefined. It related to the part of code placed in open_table_from_share() fuction where we initialize record buffer only if HAVE_purify is enabled. So in case of HAVE_purify=OFF record buffer is not initialized on open table stage. Next we read key, find NULL value and update appropriate null bit but do not update record buffer. After that the record is stored in the join cache(store_record_in_cache). For CHAR fields we strip trailing spaces and in our case this procedure uses uninitialized record buffer. The fix is to skip stripping space procedure in case of null values for CHAR fields(partially based on 6.0 JOIN_CACHE implementation). mysql-test/r/join.result: test case mysql-test/t/join.test: test case sql/field.cc: code updated according to new CACHE_FIELD struct sql/sql_select.cc: code updated according to new CACHE_FIELD struct sql/sql_select.h: CACHE_FIELD struct: added new fields: Field *field, uint type; removed fields: Field_blob *blob_field, bool strip; --- mysql-test/t/join.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index dbf36dedec8..645321a3a5e 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -804,3 +804,15 @@ DEALLOCATE PREPARE stmt; DROP VIEW v1; DROP TABLE t1, t2; + +# +# Bug#45195 valgrind warnings about uninitialized values in store_record_in_cache() +# +CREATE TABLE t1(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM; +CREATE TABLE t2(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM; +INSERT INTO t1 VALUES ('1',null),(null,null); +INSERT INTO t2 VALUES ('1',null),(null,null); +CREATE TABLE mm1(a CHAR(9),b INT,KEY(b),KEY(a)) +ENGINE=MERGE UNION=(t1,t2); +SELECT t1.a FROM mm1,t1; +DROP TABLE t1, t2, mm1; -- cgit v1.2.1 From 242f4dda3ae110ac51664b6ee49a2c9435cb6167 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 11 Feb 2010 14:26:58 +0100 Subject: renaming test variables+c to variables_community, + is problematic --- mysql-test/t/variables+c.test | 11 ----------- mysql-test/t/variables_community.test | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 mysql-test/t/variables+c.test create mode 100644 mysql-test/t/variables_community.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/variables+c.test b/mysql-test/t/variables+c.test deleted file mode 100644 index 0092d34133d..00000000000 --- a/mysql-test/t/variables+c.test +++ /dev/null @@ -1,11 +0,0 @@ ---source include/have_community_features.inc - -# -# Bug#24822: Patch: uptime_since_flush_status -# ---replace_column 2 # -show global status like "Uptime_%"; -flush status; ---replace_column 2 # -show global status like "Uptime_%"; # Almost certainly zero - diff --git a/mysql-test/t/variables_community.test b/mysql-test/t/variables_community.test new file mode 100644 index 00000000000..0092d34133d --- /dev/null +++ b/mysql-test/t/variables_community.test @@ -0,0 +1,11 @@ +--source include/have_community_features.inc + +# +# Bug#24822: Patch: uptime_since_flush_status +# +--replace_column 2 # +show global status like "Uptime_%"; +flush status; +--replace_column 2 # +show global status like "Uptime_%"; # Almost certainly zero + -- cgit v1.2.1 From 07c30f911e86b34f004f15b26771a4b20a513b15 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Sat, 13 Feb 2010 08:35:14 -0200 Subject: Bug#50624: crash in check_table_access during call procedure This bug is just one facet of stored routines not being able to detect changes in meta-data (WL#4179). This particular problem can be triggered within a single session due to the improper management of the pre-locking list if the view is expanded after the pre-locking list is calculated. Since the overall solution for the meta-data detection issue is planned for a later release, for now a workaround is used to fix this particular aspect that only involves a single session. The workaround is to flush the thread-local stored routine cache every time a view is created or modified, causing locally cached routines to be re-evaluated upon invocation. mysql-test/r/sp-bugs.result: Add test case result for Bug#50624. mysql-test/t/sp-bugs.test: Add test case for Bug#50624. sql/sp_cache.cc: Update function description. sql/sql_view.cc: Invalidate the SP cache if a view is being created or modified. --- mysql-test/t/sp-bugs.test | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/sp-bugs.test b/mysql-test/t/sp-bugs.test index 1eb283f7874..8aa0791e265 100644 --- a/mysql-test/t/sp-bugs.test +++ b/mysql-test/t/sp-bugs.test @@ -80,4 +80,25 @@ CALL p1 (); DROP TABLE t1; DROP PROCEDURE p1; +--echo # +--echo # Bug#50423: Crash on second call of a procedure dropping a trigger +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TRIGGER IF EXISTS tr1; +DROP PROCEDURE IF EXISTS p1; +--enable_warnings + +CREATE TABLE t1 (f1 INTEGER); +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1; +CREATE PROCEDURE p1 () DROP TRIGGER tr1; + +CALL p1 (); +--error ER_TRG_DOES_NOT_EXIST +CALL p1 (); + +DROP TABLE t1; +DROP PROCEDURE p1; + --echo End of 5.1 tests -- cgit v1.2.1 From 82e2d858a441295e3c2d2714df43f8118ff7048f Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Tue, 16 Feb 2010 13:13:49 +0400 Subject: Bug#50591 bit(31) causes Duplicate entry '1-NULL' for key 'group_key' The problem is that during temporary table creation uneven bits are not taken into account for hidden fields. It leads to incorrect calculation&allocation of null bytes size for table record. And if grouped value is null we set wrong bit for this value(see end_update()). Fixed by adding separate calculation of uneven bit for hidden fields. mysql-test/r/type_bit.result: test case mysql-test/t/type_bit.test: test case sql/sql_select.cc: added separate calculation of uneven bit for hidden fields --- mysql-test/t/type_bit.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test index 530389b3ab9..8bedf9357ef 100644 --- a/mysql-test/t/type_bit.test +++ b/mysql-test/t/type_bit.test @@ -425,4 +425,17 @@ select hex(a) from t1; show create table t1; drop table t1; +--echo # +--echo # Bug#50591 bit(31) causes Duplicate entry '1-NULL' for key 'group_key' +--echo # +CREATE TABLE t1(a INT, b BIT(7) NOT NULL); +INSERT INTO t1 VALUES (NULL, 0),(NULL, 0); +SELECT SUM(a) FROM t1 GROUP BY b, a; +DROP TABLE t1; + +CREATE TABLE t1(a INT, b BIT(7) NOT NULL, c BIT(8) NOT NULL); +INSERT INTO t1 VALUES (NULL, 0, 0),(NULL, 0, 0); +SELECT SUM(a) FROM t1 GROUP BY c, b, a; +DROP TABLE t1; + --echo End of 5.1 tests -- cgit v1.2.1 From 7e4d89c97379249ace6633bc406ff2ec2418252a Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Tue, 16 Feb 2010 08:41:11 -0800 Subject: WL#86: Partitioned key cache for MyISAM. This is the base patch for the task. --- mysql-test/t/key_cache.test | 268 ++++++++++++++++++++++++++++++- mysql-test/t/select_pkeycache-master.opt | 1 + mysql-test/t/select_pkeycache.test | 8 + 3 files changed, 274 insertions(+), 3 deletions(-) create mode 100644 mysql-test/t/select_pkeycache-master.opt create mode 100644 mysql-test/t/select_pkeycache.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index 4c14dc96aaa..f0222353b15 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -1,11 +1,13 @@ # -# Test of multiple key caches +# Test of multiple key caches, simple an partitioned # --disable_warnings drop table if exists t1, t2, t3; --enable_warnings -SET @save_key_buffer=@@key_buffer_size; +SET @save_key_buffer_size=@@key_buffer_size; +SET @save_key_cache_block_size=@@key_cache_block_size; +SET @save_key_cache_partitions=@@key_cache_partitions; SELECT @@key_buffer_size, @@small.key_buffer_size; @@ -33,7 +35,7 @@ SELECT @@`default`.key_buffer_size; SELECT @@small.key_buffer_size; SELECT @@medium.key_buffer_size; -SET @@global.key_buffer_size=@save_key_buffer; +SET @@global.key_buffer_size=@save_key_buffer_size; # # Errors @@ -247,3 +249,263 @@ SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size; DROP TABLE t1; # End of 4.1 tests + +# +# Test cases for partitioned key caches +# + +# Test usage of the KEY_CACHE table from information schema +# for a simple key cache + +set global key_buffer_size=@save_key_buffer_size; +set global key_cache_block_size=@save_key_cache_block_size; +select @@key_buffer_size; +select @@key_cache_block_size; +select @@key_cache_partitions; + +create table t1 ( + p int not null auto_increment primary key, + a char(10)); +create table t2 ( + p int not null auto_increment primary key, + i int, a char(10), key k1(i), key k2(a)); + +select @@key_cache_partitions; +--replace_column 7 # +select * from information_schema.key_caches; + +insert into t1 values (1, 'qqqq'), (2, 'yyyy'); +insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), + (3, 1, 'yyyy'), (4, 3, 'zzzz'); +select * from t1; +select * from t2; +update t1 set p=3 where p=1; +update t2 set i=2 where i=1; + +--replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED +show status like 'key_%'; +--replace_column 7 # +select * from information_schema.key_caches; + +delete from t2 where a='zzzz'; +--replace_column 7 # +select * from information_schema.key_caches; + +delete from t1; +delete from t2; +--replace_column 7 # +select * from information_schema.key_caches; + +# For the key cache with 2 partitions execute the same sequence of +# statements as for the simple cache above. +# The statistical information on the number of i/o requests and +# the number of is expected to be the same. + +set global key_cache_partitions=2; +select @@key_cache_partitions; +--replace_column 7 # +select * from information_schema.key_caches; + +insert into t1 values (1, 'qqqq'), (2, 'yyyy'); +insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), + (3, 1, 'yyyy'), (4, 3, 'zzzz'); +select * from t1; +select * from t2; +update t1 set p=3 where p=1; +update t2 set i=2 where i=1; + +--replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED +show status like 'key_%'; +--replace_column 7 # +select * from information_schema.key_caches; + +delete from t1; +delete from t2; +--replace_column 7 # +select * from information_schema.key_caches; + +# Check that we can work with one partition with the same results + +set global key_cache_partitions=1; +select @@key_cache_partitions; +--replace_column 7 # +select * from information_schema.key_caches; + +insert into t1 values (1, 'qqqq'), (2, 'yyyy'); +insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), + (3, 1, 'yyyy'), (4, 3, 'zzzz'); +select * from t1; +select * from t2; +update t1 set p=3 where p=1; +update t2 set i=2 where i=1; + +--replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED +show status like 'key_%'; +--replace_column 7 # +select * from information_schema.key_caches; + +delete from t1; +delete from t2; +--replace_column 7 # +select * from information_schema.key_caches; + +flush tables; flush status; +--replace_column 7 # +select * from information_schema.key_caches; + +# Switch back to 2 partitions + +set global key_buffer_size=32*1024; +select @@key_buffer_size; +set global key_cache_partitions=2; +select @@key_cache_partitions; +--replace_column 7 # +select * from information_schema.key_caches; + +insert into t1 values (1, 'qqqq'), (2, 'yyyy'); +insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), + (3, 1, 'yyyy'), (4, 3, 'zzzz'); +select * from t1; +select * from t2; +update t1 set p=3 where p=1; +update t2 set i=2 where i=1; + +--replace_column 7 # +select * from information_schema.key_caches; + +# Add more rows to tables t1 and t2 + +insert into t1(a) select a from t1; +insert into t1(a) select a from t1; +insert into t1(a) select a from t1; +insert into t1(a) select a from t1; +insert into t1(a) select a from t1; +insert into t1(a) select a from t1; +insert into t1(a) select a from t1; +insert into t1(a) select a from t1; + +insert into t2(i,a) select i,a from t2; +insert into t2(i,a) select i,a from t2; +insert into t2(i,a) select i,a from t2; +insert into t2(i,a) select i,a from t2; +insert into t2(i,a) select i,a from t2; +insert into t2(i,a) select i,a from t2; +insert into t2(i,a) select i,a from t2; +insert into t2(i,a) select i,a from t2; + +--replace_column 6 # 7 # 10 # +select * from information_schema.key_caches; + +select * from t1 where p between 1010 and 1020 ; +select * from t2 where p between 1010 and 1020 ; +--replace_column 6 # 7 # 10 # +select * from information_schema.key_caches; + +flush tables; flush status; +update t1 set a='zzzz' where a='qqqq'; +update t2 set i=1 where i=2; +--replace_column 6 # 7 # +select * from information_schema.key_caches; + +# Now test how we can work with 7 partitions + +set global keycache1.key_buffer_size=256*1024; +select @@keycache1.key_buffer_size; +set global keycache1.key_cache_partitions=7; +select @@keycache1.key_cache_partitions; + +--replace_column 6 # 7 # +select * from information_schema.key_caches; +--replace_column 7 # +select * from information_schema.key_caches where key_cache_name like "key%"; + +cache index t1 key (`primary`) in keycache1; + +explain select p from t1 where p between 1010 and 1020; +select p from t1 where p between 1010 and 1020; +explain select i from t2 where p between 1010 and 1020; +select i from t2 where p between 1010 and 1020; +explain select count(*) from t1, t2 where t1.p = t2.i; +select count(*) from t1, t2 where t1.p = t2.i; + +--replace_column 6 # 7 # +select * from information_schema.key_caches; +--replace_column 7 # +select * from information_schema.key_caches where key_cache_name like "key%"; + +cache index t2 in keycache1; +update t2 set p=p+3000, i=2 where a='qqqq'; +--replace_column 7 # +select * from information_schema.key_caches where key_cache_name like "key%"; + +set global keycache2.key_buffer_size=1024*1024; +cache index t2 in keycache2; +insert into t2 values (2000, 3, 'yyyy'); +--replace_column 7 # +select * from information_schema.key_caches where key_cache_name like "keycache2"; +--replace_column 7 # +select * from information_schema.key_caches where key_cache_name like "key%"; + +cache index t2 in keycache1; +update t2 set p=p+5000 where a='zzzz'; +select * from t2 where p between 1010 and 1020; +explain select p from t2 where p between 1010 and 1020; +select p from t2 where p between 1010 and 1020; +explain select i from t2 where a='yyyy' and i=3; +select i from t2 where a='yyyy' and i=3; +explain select a from t2 where a='yyyy' and i=3; +select a from t2 where a='yyyy' and i=3 ; +--replace_column 6 # 7 # +select * from information_schema.key_caches; + +set global keycache1.key_cache_block_size=2*1024; +insert into t2 values (7000, 3, 'yyyy'); +--replace_column 6 # 7 # +select * from information_schema.key_caches; + +set global keycache1.key_cache_block_size=8*1024; +insert into t2 values (8000, 3, 'yyyy'); +--replace_column 6 # 7 # +select * from information_schema.key_caches; + +set global keycache1.key_buffer_size=64*1024; +--replace_column 6 # 7 # +select * from information_schema.key_caches; + +set global keycache1.key_cache_block_size=2*1024; +--replace_column 6 # 7 # +select * from information_schema.key_caches; + +set global keycache1.key_cache_block_size=8*1024; +--replace_column 6 # 7 # +select * from information_schema.key_caches; + +set global keycache1.key_buffer_size=0; +--replace_column 6 # 7 # +select * from information_schema.key_caches; + +set global keycache1.key_cache_block_size=8*1024; +--replace_column 6 # 7 # +select * from information_schema.key_caches; + +set global keycache1.key_buffer_size=0; +--replace_column 6 # 7 # +select * from information_schema.key_caches; + +set global keycache1.key_buffer_size=128*1024; +--replace_column 6 # 7 # +select * from information_schema.key_caches; + +set global keycache1.key_cache_block_size=1024; +--replace_column 6 # 7 # +select * from information_schema.key_caches; + +drop table t1,t2; + +set global keycache1.key_buffer_size=0; +set global keycache2.key_buffer_size=0; + +set global key_buffer_size=@save_key_buffer_size; +set global key_cache_partitions=@save_key_cache_partitions; + +#End of 5.1 tests diff --git a/mysql-test/t/select_pkeycache-master.opt b/mysql-test/t/select_pkeycache-master.opt new file mode 100644 index 00000000000..b4ba5b8ca5d --- /dev/null +++ b/mysql-test/t/select_pkeycache-master.opt @@ -0,0 +1 @@ +--key_cache_partitions=7 diff --git a/mysql-test/t/select_pkeycache.test b/mysql-test/t/select_pkeycache.test new file mode 100644 index 00000000000..4216e9a5156 --- /dev/null +++ b/mysql-test/t/select_pkeycache.test @@ -0,0 +1,8 @@ + +# +# Run select.test partitioned default key cache (with 7 partitions) +# (see setting the number of partitions in select_pkecache-master.opt) +# The result is expected the same as for select.test +# + +--source t/select.test -- cgit v1.2.1 From 4b260b668d66cfd6f7e8c2612461c66d2914219d Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 17 Feb 2010 16:13:42 +0400 Subject: Bug#33717 INSERT...(default) fails for enum. Crashes CSV tables, loads spaces for MyISAM Table corruption happens during table reading in ha_tina::find_current_row() func. Field::store() method returns error(true) if stored value is 0. The fix: added special case for enum type which correctly processes 0 value. Additional fix: INSERT...(default) and INSERT...() have the same behaviour now for enum type. mysql-test/r/csv.result: test result mysql-test/r/default.result: result fix mysql-test/t/csv.test: test case sql/item.cc: Changes: do not print warning for 'enum' type if there is no default value. set default value. storage/csv/ha_tina.cc: Table corruption happens during table reading in ha_tina::find_current_row() func. Field::store() method returns error(true) if stored value is 0. The fix: added special case for enum type which correctly processes 0 value. --- mysql-test/t/csv.test | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index cdf274190dd..b31fa83588b 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1807,16 +1807,16 @@ unlock tables; drop table t1; # -# Bug#41441 repair csv table crashes debug server -# -# Note: The test should be removed after Bug#33717 is fixed +# Bug#33717 INSERT...(default) fails for enum. Crashes CSV tables, loads spaces for MyISAM +# +CREATE TABLE t1 (e enum('foo','bar') NOT NULL) ENGINE = CSV; +INSERT INTO t1 VALUES(); +INSERT INTO t1 VALUES(default); +INSERT INTO t1 VALUES(0); +INSERT INTO t1 VALUES(3); +INSERT INTO t1 VALUES(-1); +SELECT * FROM t1; +DROP TABLE t1; -create table t1(a enum ('a') not null) engine=csv; -insert into t1 values (2); ---error ER_CRASHED_ON_USAGE -select * from t1 limit 1; -repair table t1; -select * from t1 limit 1; -drop table t1; --echo End of 5.1 tests -- cgit v1.2.1 From f0b38904aaca492acb408aaf571758d9a8f9b83d Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Wed, 17 Feb 2010 18:07:28 +0000 Subject: BUG#48993: valgrind errors in mysqlbinlog I found three issues during the analysis: 1. Memory leak caused by temp_buf not being freed; 2. Memory leak caused when handling argv; 3. Conditional jump that depended on unitialized values. Issue #1 -------- DESCRIPTION: when mysqlbinlog is reading from a remote location the event temp_buf references the incoming stream (in NET object), which is not freed by mysqlbinlog explicitly. On the other hand, when it is reading local binary log, it points to a temporary buffer that needs to be explicitly freed. For both cases, the temp_buf was not freed by mysqlbinlog, instead was set to 0. This clearly disregards the free required in the second case, thence creating a memory leak. FIX: we make temp_buf to be conditionally freed depending on the value of remote_opt. Found out that similar fix is already in most recent codebases. Issue #2 -------- DESCRIPTION: load_defaults is called by parse_args, and it reads default options from configuration files and put them BEFORE the arguments that are already in argc and argv. This is done resorting to MEM_ROOT. However, parse_args calls handle_options immediately after which changes argv. Later when freeing the defaults, pointers to MEM_ROOT won't match, causing the memory not to be freed: void free_defaults(char **argv) { MEM_ROOT ptr memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr)); free_root(&ptr,MYF(0)); } FIX: we remove load_defaults from parse_args and call it before. Then we save argv with defaults in defaults_argv BEFORE calling parse_args (which inside can then call handle_options at will). Actually, found out that this is in fact kind of a backport for BUG#38468 into 5.1, so I merged in the test case as well and added error check for load_defaults call. Fix based on: revid:zhenxing.he@sun.com-20091002081840-uv26f0flw4uvo33y Issue #3 -------- DESCRIPTION: the structure st_print_event_info constructor would not initialize the sql_mode member, although it did for sql_mode_inited (set to false). This would later raise the warning in valgrind when printing the sql_mode in the event header, as this print out is protected by a check against sql_mode_inited and sql_mode variables. Given that sql_mode was not initialized valgrind would output the warning. FIX: we add initialization of sql_mode to the st_print_event_info constructor. client/mysqlbinlog.cc: - Conditionally free ev->temp_buf. - save defaults_argv before handle_options is called. mysql-test/t/mysqlbinlog.test: Added test case from BUG#38468. sql/log_event.cc: Added initialization of sql_mode for st_print_event_info. --- mysql-test/t/mysqlbinlog.test | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 687ad62b17c..0d3f0a8a7c4 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -443,3 +443,27 @@ FLUSH LOGS; --echo End of 5.0 tests --echo End of 5.1 tests + +# +# BUG#38468 Memory leak detected when using mysqlbinlog utility; +# +disable_query_log; +RESET MASTER; +CREATE TABLE t1 SELECT 1; +FLUSH LOGS; +DROP TABLE t1; +enable_query_log; + +# Write an empty file for comparison +write_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty; +EOF + +# Before fix of BUG#38468, this would generate some warnings +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 >/dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn + +# Make sure the command above does not generate any error or warnings +diff_files $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty; + +# Cleanup for this part of test +remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty; +remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn; -- cgit v1.2.1 From 20dfd709d6454f8cdc25262c945ad203cecafc02 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Thu, 18 Feb 2010 10:48:15 +0200 Subject: Bug #51049: main.bug39022 fails in mysql-trunk-merge Fixed the test to behave correctly with ps-protocol and binlog format row. --- mysql-test/t/bug39022.test | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/bug39022.test b/mysql-test/t/bug39022.test index 1a1d10f5592..268b207e0e5 100644 --- a/mysql-test/t/bug39022.test +++ b/mysql-test/t/bug39022.test @@ -1,5 +1,6 @@ -- source include/have_log_bin.inc -- source include/have_innodb.inc +-- source include/not_binlog_format_row.inc --echo # --echo # Bug #39022: Mysql randomly crashing in lock_sec_rec_cons_read_sees @@ -49,10 +50,14 @@ connection thread2; --echo # in thread2 REAP; -connection default; ---echo # in default +disconnect thread2; +--source include/wait_until_disconnected.inc +connection thread1; +--echo # in thread1; disconnect thread1; -disconnect thread2; +--source include/wait_until_disconnected.inc + +connection default; DROP TABLE t1,t2; -- cgit v1.2.1 From e0fbc5d248e4d35920553417f13701484b20f622 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Thu, 18 Feb 2010 17:02:17 +0000 Subject: Bug#48525: trigger changes "Column 'id' cannot be null" behaviour CHECK_FIELD_IGNORE was treated as CHECK_FIELD_ERROR_FOR_NULL; UPDATE...SET...NULL on NOT NULL fields behaved differently after a trigger. Now distinguishes between IGNORE and ERROR_FOR_NULL and save/restores check-field options. mysql-test/r/trigger.result: Show that UPDATE...SET...NULL on NOT NULL columns doesn't behave differently when run after a trigger. mysql-test/t/trigger.test: Show that UPDATE...SET...NULL on NOT NULL columns doesn't behave differently when run after a trigger. sql/field_conv.cc: CHECK_FIELD_IGNORE was treated as CHECK_FIELD_ERROR_FOR_NULL. Distinguish between the two. sql/sp_head.cc: raise error as needed sql/sql_class.cc: Save and restore check-fields options. sql/sql_class.h: Make room so we can save check-fields options. sql/sql_insert.cc: raise error as needed --- mysql-test/t/trigger.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 1e55f9d5993..db41a12a9ac 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -2396,4 +2396,17 @@ SELECT * FROM t2; DROP TABLE t1, t2; +# +# Bug #48525: trigger changes "Column 'id' cannot be null" behaviour +# +CREATE TABLE t1 (id INT NOT NULL); +CREATE TABLE t2 (id INT NOT NULL); +INSERT t1 VALUES (1),(2),(3); +UPDATE t1 SET id=NULL; +CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW + INSERT INTO t2 VALUES (3); +UPDATE t1 SET id=NULL; +DROP TRIGGER t1_bu; +DROP TABLE t1,t2; + --echo End of 5.1 tests. -- cgit v1.2.1 From 1fc1f462b6d469d7b1f2bb94ba99f4554ced1cd5 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Fri, 19 Feb 2010 15:16:43 +0000 Subject: Bug#49487: crash with explain extended and group_concat in a derived table When EXPLAIN EXTENDED tries to print column names, it checks whether the referenced table is CONST (in which case, the column's value rather than its name will be printed). If no proper table is reference (i.e. because a derived table was used that has since gone out of scope), this will fail spectacularly. This ports an equivalent of the fix for Bug 43354. mysql-test/r/func_gconcat.result: Show that EXPLAIN EXTENDED on a GROUP_CONCAT() on a derived table no longer crashes the server. mysql-test/t/func_gconcat.test: Show that EXPLAIN EXTENDED on a GROUP_CONCAT() on a derived table no longer crashes the server. sql/item_sum.cc: Do not de-ref what cannot be, that is, temp-tables that have gone away. This is of questionable utility anyway, since our deref has the sole purpose of checking whether the table is const (in which case, we'll substitute the column with its value in EXPLAIN EXTENDED - that is all). --- mysql-test/t/func_gconcat.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 816ac9c2959..1cbf045e95d 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -693,4 +693,19 @@ SELECT 1 FROM t1 WHERE t1.a NOT IN DROP TABLE t1, t2; +# +# Bug #49487: crash with explain extended and group_concat in a derived table +# + +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (),(); + +EXPLAIN EXTENDED SELECT 1 FROM + (SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1; + +SELECT 1 FROM + (SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1; + +DROP TABLE t1; + --echo End of 5.0 tests -- cgit v1.2.1 From dad7b3c55e2f4da0d3b03e561bea20153b03a720 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Mon, 22 Feb 2010 16:58:56 +0000 Subject: revert 48525 --- mysql-test/t/trigger.test | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index db41a12a9ac..1e55f9d5993 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -2396,17 +2396,4 @@ SELECT * FROM t2; DROP TABLE t1, t2; -# -# Bug #48525: trigger changes "Column 'id' cannot be null" behaviour -# -CREATE TABLE t1 (id INT NOT NULL); -CREATE TABLE t2 (id INT NOT NULL); -INSERT t1 VALUES (1),(2),(3); -UPDATE t1 SET id=NULL; -CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW - INSERT INTO t2 VALUES (3); -UPDATE t1 SET id=NULL; -DROP TRIGGER t1_bu; -DROP TABLE t1,t2; - --echo End of 5.1 tests. -- cgit v1.2.1 From e3d0b6d7929ce7080958086c6f4fca61dd13de2e Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Thu, 25 Feb 2010 16:57:15 +0200 Subject: Backport of the fix for bug #49552 to 5.0-bugteam --- mysql-test/t/delete.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index ec70587c9d1..d9091c92a52 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -247,4 +247,19 @@ DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1; DROP TABLE t1; DROP FUNCTION f1; + +--echo # +--echo # Bug #49552 : sql_buffer_result cause crash + not found records +--echo # in multitable delete/subquery +--echo # + +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SET SESSION SQL_BUFFER_RESULT=1; +DELETE t1 FROM (SELECT SUM(a) a FROM t1) x,t1; + +SET SESSION SQL_BUFFER_RESULT=DEFAULT; +SELECT * FROM t1; +DROP TABLE t1; + --echo End of 5.0 tests -- cgit v1.2.1 From 9201bff16b93743aa1a8bfaeff990daf050a2a8d Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Thu, 25 Feb 2010 18:48:53 +0300 Subject: Bug #50335: Assertion `!(order->used & map)' in eq_ref_table The problem was in an incorrect debug assertion. The expression used in the failing assertion states that when finding references matching ORDER BY expressions, there can be only one reference to a single table. But that does not make any sense, all test cases for this bug are valid examples with multiple identical WHERE expressions referencing the same table which are also present in the ORDER BY list. Fixed by removing the failing assertion. We also have to take care of the 'found' counter so that we count multiple references only once. We rely on this fact later in eq_ref_table(). mysql-test/r/join.result: Added a test case for bug #50335. mysql-test/t/join.test: Added a test case for bug #50335. sql/sql_select.cc: Removing the assertion in eq_ref_table() as it does not make any sense. We also have to take care of the 'found' counter so that we count multiple references only once. We rely on this fact later in eq_ref_table(). --- mysql-test/t/join.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 645321a3a5e..761121313e5 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -816,3 +816,16 @@ CREATE TABLE mm1(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MERGE UNION=(t1,t2); SELECT t1.a FROM mm1,t1; DROP TABLE t1, t2, mm1; + +--echo # +--echo # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table +--echo # + +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b)); +INSERT INTO t1 VALUES (0,0), (1,1); + +SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a; + +DROP TABLE t1; + +--echo End of 5.1 tests -- cgit v1.2.1 From 936ed6ca86633a91976fd6fcd931683ec007f440 Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Thu, 25 Feb 2010 23:13:11 +0400 Subject: Bug #45360: wrong results Propagation of a large unsigned numeric constant in the WHERE expression led to wrong result. For example, "WHERE a = CAST(0xFFFFFFFFFFFFFFFF AS USIGNED) AND FOO(a)", where a is an UNSIGNED BIGINT, and FOO() accepts strings, was transformed to "... AND FOO('-1')". That has been fixed. Also EXPLAIN EXTENDED printed incorrect numeric constants in transformed WHERE expressions like above. That has been fixed too. mysql-test/r/bigint.result: Added test case for bug #45360. mysql-test/t/bigint.test: Added test case for bug #45360. sql/item.cc: Bug #45360: wrong results As far as Item_int_with_ref (and underlaying Item_int) class accepts both signed and unsigned 64bit values, Item_int::val_str and Item_int::print methods have been modified to take into account unsigned_flag. --- mysql-test/t/bigint.test | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 5a589816dcd..e19bba971f9 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -327,3 +327,38 @@ drop table t1; create table t1 select -9223372036854775809 bi; describe t1; drop table t1; + +--echo # +--echo # Bug #45360: wrong results +--echo # + +CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, + a BIGINT(20) UNSIGNED, + b VARCHAR(20)); + +INSERT INTO t1 (a) VALUES + (0), + (CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED)), + (CAST(0x8000000000000000 AS UNSIGNED)), + (CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED)); + +UPDATE t1 SET b = a; + +let $n = `SELECT MAX(id) FROM t1`; +while($n) { + let $x = `SELECT a FROM t1 WHERE id = $n`; + dec $n; + let $hex = `SELECT HEX($x)`; + echo # $hex; + + --disable_result_log + eval EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = $x AND TRIM(a) = b; + --enable_result_log + SHOW WARNINGS; +} + +DROP TABLE t1; + +--echo # End of 5.1 tests + + -- cgit v1.2.1 From f1c641d1b614a7c862534b96f859f370dba50dc8 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 26 Feb 2010 13:02:05 +0400 Subject: Applying InnoDB snapshot Detailed revision comments: r6536 | sunny | 2010-01-30 00:13:42 +0200 (Sat, 30 Jan 2010) | 6 lines branches/5.1: Check *first_value everytime against the column max value and set *first_value to next autoinc if it's > col max value. ie. not rely on what is passed in from MySQL. [49497] Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value rb://236 --- mysql-test/t/innodb-autoinc.test | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test index bb431408937..ef0359b78b0 100644 --- a/mysql-test/t/innodb-autoinc.test +++ b/mysql-test/t/innodb-autoinc.test @@ -631,3 +631,34 @@ REPLACE INTO t1 VALUES (-1); SELECT * FROM t1; SHOW CREATE TABLE t1; DROP TABLE t1; + +## +# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL); +INSERT INTO t1 VALUES (4), (5), (6), (NULL); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; -- cgit v1.2.1 From 7633ece07dab432b598c3d4b40c96fc06b77cb6d Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 26 Feb 2010 13:02:26 +0400 Subject: Applying InnoDB snapshot Detailed revision comments: r6537 | sunny | 2010-01-30 00:35:00 +0200 (Sat, 30 Jan 2010) | 2 lines branches/5.1: Undo r6536. --- mysql-test/t/innodb-autoinc.test | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test index ef0359b78b0..bb431408937 100644 --- a/mysql-test/t/innodb-autoinc.test +++ b/mysql-test/t/innodb-autoinc.test @@ -631,34 +631,3 @@ REPLACE INTO t1 VALUES (-1); SELECT * FROM t1; SHOW CREATE TABLE t1; DROP TABLE t1; - -## -# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL); -INSERT INTO t1 VALUES (4), (5), (6), (NULL); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -- cgit v1.2.1 From 57c328ba659d8bc796e476f7040eb46be27f52bf Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 26 Feb 2010 13:02:57 +0400 Subject: Applying InnoDB snapshot Detailed revision comments: r6538 | sunny | 2010-01-30 00:43:06 +0200 (Sat, 30 Jan 2010) | 6 lines branches/5.1: Check *first_value every time against the column max value and set *first_value to next autoinc if it's > col max value. ie. not rely on what is passed in from MySQL. [49497] Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value rb://236 --- mysql-test/t/innodb-autoinc.test | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test index bb431408937..ef0359b78b0 100644 --- a/mysql-test/t/innodb-autoinc.test +++ b/mysql-test/t/innodb-autoinc.test @@ -631,3 +631,34 @@ REPLACE INTO t1 VALUES (-1); SELECT * FROM t1; SHOW CREATE TABLE t1; DROP TABLE t1; + +## +# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL); +INSERT INTO t1 VALUES (4), (5), (6), (NULL); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; -- cgit v1.2.1 From 2d4db52edac1488c9481b303095229b424288e64 Mon Sep 17 00:00:00 2001 From: Evgeny Potemkin Date: Fri, 26 Feb 2010 14:17:00 +0300 Subject: Bug#50843: Filesort used instead of clustered index led to performance degradation. Filesort + join cache combination is preferred to full index scan because it is usually faster. But it's not the case when the index is clustered one. Now test_if_skip_sort_order function prefers filesort only if index isn't clustered. mysql-test/r/innodb_mysql.result: Added a test case for the bug#50843. mysql-test/t/innodb_mysql.test: Added a test case for the bug#50843. sql/sql_select.cc: Bug#50843: Filesort used instead of clustered index led to performance degradation. Now test_if_skip_sort_order function prefers filesort only if index isn't clustered. --- mysql-test/t/innodb_mysql.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index d9fecccfbdc..a3c11b8b8d6 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -545,5 +545,17 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb ; SELECT 1 FROM t1 JOIN t1 a USING(a) GROUP BY t1.a,t1.a; DROP TABLE t1; +--echo # +--echo # Bug#50843: Filesort used instead of clustered index led to +--echo # performance degradation. +--echo # +create table t1(f1 int not null primary key, f2 int) engine=innodb; +create table t2(f1 int not null, key (f1)) engine=innodb; +insert into t1 values (1,1),(2,2),(3,3); +insert into t2 values (1),(2),(3); +explain select t1.* from t1 left join t2 using(f1) group by t1.f1; +drop table t1,t2; +--echo # + --echo End of 5.1 tests -- cgit v1.2.1 From 9245ed4a12ce25214d60f93cbf20882cb2b78741 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 26 Feb 2010 15:39:25 +0400 Subject: Bug#50995 Having clause on subquery result produces incorrect results. The problem is that cond->fix_fields(thd, 0) breaks condition(cuts off 'having'). The reason of that is that NULL valued Item pointer is present in the middle of Item list and it breaks the Item processing loop. mysql-test/r/having.result: test case mysql-test/t/having.test: test case sql/item_cmpfunc.h: added ASSERT to make sure that we do not add NULL valued Item pointer sql/sql_select.cc: skip adding an item to condition if Item pointer is NULL. skip adding a list to condition if this list is empty. --- mysql-test/t/having.test | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index af9af4fe1fc..185ca4bdddb 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -442,4 +442,30 @@ INSERT INTO t1 VALUES (1, 1), (2,2), (3, NULL); SELECT b, COUNT(DISTINCT a) FROM t1 GROUP BY b HAVING b is NULL; DROP TABLE t1; + +--echo # +--echo # Bug#50995 Having clause on subquery result produces incorrect results. +--echo # + +CREATE TABLE t1 +( + id1 INT, + id2 INT NOT NULL, + INDEX id1(id2) +); + +INSERT INTO t1 SET id1=1, id2=1; +INSERT INTO t1 SET id1=2, id2=1; +INSERT INTO t1 SET id1=3, id2=1; + +SELECT t1.id1, +(SELECT 0 FROM DUAL + WHERE t1.id1=t1.id1) AS amount FROM t1 +WHERE t1.id2 = 1 +HAVING amount > 0 +ORDER BY t1.id1; + +DROP TABLE t1; + + --echo End of 5.0 tests -- cgit v1.2.1 From ca6691533a7e2a454bbb614583a0058bf7acd2d2 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 26 Feb 2010 17:40:01 +0400 Subject: Bug#47669 Query showed by EXPLAIN EXTENDED gives different result from original query Item_field::print method does not take into account fields whose values may be null. The fix is to print 'NULL' if field value is null. mysql-test/r/explain.result: test case mysql-test/r/func_str.result: result fix mysql-test/r/having.result: result fix mysql-test/r/select.result: result fix mysql-test/r/subselect.result: result fix mysql-test/r/union.result: result fix mysql-test/t/explain.test: test case sql/item.cc: print 'NULL' if field value is null. --- mysql-test/t/explain.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test index 77b49a8b1a5..2af0ffc0cbd 100644 --- a/mysql-test/t/explain.test +++ b/mysql-test/t/explain.test @@ -187,4 +187,16 @@ SET SESSION sql_mode=@old_sql_mode; DROP TABLE t1; +--echo # +--echo # Bug#47669: Query showed by EXPLAIN EXTENDED gives different result from original query +--echo # + +CREATE TABLE t1 (c int); +INSERT INTO t1 VALUES (NULL); +CREATE TABLE t2 (d int); +INSERT INTO t2 VALUES (NULL), (0); +EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) FROM t1; +DROP TABLE t1, t2; + + --echo End of 5.1 tests. -- cgit v1.2.1 From b0a1ae09ae12bb3eefda03ff91263a3c860fd49b Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 26 Feb 2010 09:22:48 -0300 Subject: Bug#49823: mysql_upgrade fatal error due to general_log / slow_low CSV NULL The problem was that the CSV storage engine does not support NULL fields, yet in some early 5.1 version the log tables (general_log and slow_log) were created with null fields. On top of this, when altering a CSV table column, all fields of the table must be NOT NULL otherwise the alteration fails. The solution is to ensure that during upgrade all columns of the log tables are NOT NULL. mysql-test/r/log_tables_upgrade.result: Add test case result for Bug#49823. mysql-test/std_data/bug49823.CSV: Sample data for test. mysql-test/std_data/bug49823.frm: Add a CSV table which mimics the general_log table, except that it contains a nullable column. mysql-test/t/log_tables_upgrade.test: Add test case for Bug#49823. scripts/mysql_system_tables_fix.sql: Ensure that all columns of the log tables are NOT NULL. --- mysql-test/t/log_tables_upgrade.test | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 mysql-test/t/log_tables_upgrade.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/log_tables_upgrade.test b/mysql-test/t/log_tables_upgrade.test new file mode 100644 index 00000000000..5d1b2b5aed6 --- /dev/null +++ b/mysql-test/t/log_tables_upgrade.test @@ -0,0 +1,32 @@ +--source include/not_embedded.inc +--source include/have_csv.inc + +# Only run test if "mysql_upgrade" is found +--require r/have_mysql_upgrade.result +--disable_query_log +select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade; +--enable_query_log + +--echo # +--echo # Bug#49823: mysql_upgrade fatal error due to general_log / slow_low CSV NULL +--echo # + +USE test; + +let $MYSQLD_DATADIR= `SELECT @@datadir`; +copy_file std_data/bug49823.frm $MYSQLD_DATADIR/test/bug49823.frm; +copy_file std_data/bug49823.CSM $MYSQLD_DATADIR/test/bug49823.CSM; +copy_file std_data/bug49823.CSV $MYSQLD_DATADIR/test/bug49823.CSV; + +SET @saved_general_log = @@GLOBAL.general_log; +SET GLOBAL general_log = OFF; +USE mysql; +FLUSH TABLES; +REPAIR TABLE test.bug49823; +RENAME TABLE general_log TO renamed_general_log; +RENAME TABLE test.bug49823 TO general_log; +--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1 +DROP TABLE general_log; +RENAME TABLE renamed_general_log TO general_log; +SET GLOBAL general_log = @saved_general_log; +USE test; -- cgit v1.2.1 From 0ecc8963a089d64afd97971a6c4631aefc4157e1 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 26 Feb 2010 23:19:59 -0300 Subject: Force execution now that another test case might run mysql_upgrade first. mysql-test/t/mysql_upgrade.test: For execution, mostly testing the presence of the binary anyway. --- mysql-test/t/mysql_upgrade.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test index 24a1d2e1b5d..6c01f3b2027 100644 --- a/mysql-test/t/mysql_upgrade.test +++ b/mysql-test/t/mysql_upgrade.test @@ -32,7 +32,7 @@ if (`SELECT $VALGRIND_TEST`) # expected binaries it uses. # --echo Run mysql_upgrade once ---exec $MYSQL_UPGRADE --skip-verbose 2>&1 +--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1 # It should have created a file in the MySQL Servers datadir let $MYSQLD_DATADIR= `select @@datadir`; -- cgit v1.2.1 From 9715539ebd9519ca66e9b803f435878a819d3f99 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Sun, 28 Feb 2010 21:29:19 +0400 Subject: Fix for bug#51304: checksum table gives different results for same data when using bit fields Problem: checksum for BIT fields may be computed incorrectly in some cases due to its storage peculiarity. Fix: convert a BIT field to a string then calculate its checksum. mysql-test/r/myisam.result: Fix for bug#51304: checksum table gives different results for same data when using bit fields - test result. mysql-test/t/myisam.test: Fix for bug#51304: checksum table gives different results for same data when using bit fields - test case. sql/sql_table.cc: Fix for bug#51304: checksum table gives different results for same data when using bit fields - convert BIT fields to strings calculating its checksums as some bits may be saved among NULL bits in the record buffer. --- mysql-test/t/myisam.test | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index d12dbce1cc1..ea7ddc88b77 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1587,5 +1587,20 @@ REPLACE INTO t1 VALUES CHECK TABLE t1; DROP TABLE t1; ---echo End of 5.1 tests +--echo # +--echo # Bug#51304: checksum table gives different results +--echo # for same data when using bit fields +--echo # +CREATE TABLE t1(a INT, b BIT(1)); +INSERT INTO t1 VALUES(1, 0), (2, 1); +CREATE TABLE t2 SELECT * FROM t1; +--copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t3.frm +--copy_file $MYSQLD_DATADIR/test/t1.MYD $MYSQLD_DATADIR/test/t3.MYD +--copy_file $MYSQLD_DATADIR/test/t1.MYI $MYSQLD_DATADIR/test/t3.MYI +CHECKSUM TABLE t1 EXTENDED; +CHECKSUM TABLE t2 EXTENDED; +CHECKSUM TABLE t3 EXTENDED; +DROP TABLE t1, t2, t3; + +--echo End of 5.1 tests -- cgit v1.2.1 From a82cc50958887464bc87e035593bb9f9fbd14d46 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Tue, 2 Mar 2010 13:45:50 +0400 Subject: BUG#51307 - widespread corruption with partitions and insert...select Queries following bulk insert into an empty MyISAM table may break it. This was pure MyISAM problem. When bulk insert into an empty table is complete, MyISAM may want to enable indexes via repair by sort. If repair by sort fails (e.g. insufficient buffer), MyISAM failover to repair with key cache, requesting repair of data file. Repair of data file performs data file substitution. This means that current table instance will point to new data file. Other cached table instances are still pointing to an old, deleted data file. This is fixed by not requesting repair of data file during enable indexes. Explicit REPAIR is not affected, since it flushes all table instances. mysql-test/r/myisam.result: A test case for BUG#51307. mysql-test/t/myisam.test: A test case for BUG#51307. storage/myisam/ha_myisam.cc: When enabling indexes do not attempt to repair data file. --- mysql-test/t/myisam.test | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index d12dbce1cc1..114e0367d51 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1587,5 +1587,33 @@ REPLACE INTO t1 VALUES CHECK TABLE t1; DROP TABLE t1; +--echo # +--echo # BUG#51307 - widespread corruption with partitions and insert...select +--echo # +CREATE TABLE t1(a CHAR(255), KEY(a)); +SELECT * FROM t1, t1 AS a1; +SET myisam_sort_buffer_size=4; +INSERT INTO t1 VALUES +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'); +SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; +INSERT INTO t1 VALUES('1'); +SELECT * FROM t1, t1 AS a1 WHERE t1.a=1 AND a1.a=1; +DROP TABLE t1; + --echo End of 5.1 tests -- cgit v1.2.1 From c610e9783aa4474d2b4418f1b3b3685716a83454 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Tue, 2 Mar 2010 18:00:53 +0000 Subject: Bug#48295: explain extended crash with subquery and ONLY_FULL_GROUP_BY sql If an outer query is broken, a subquery might not even get set up. EXPLAIN EXTENDED did not expect this and merrily tried to de-ref all of the half-setup info. We now catch this case and print as much as we have, as it doesn't cost us anything (doesn't make regular execution slower). backport from 5.1 mysql-test/r/explain.result: Show that EXPLAIN EXTENDED with subquery and illegal out query doesn't crash. Show also that SHOW WARNINGS will render an additional Note in the hope of being, well, helpful. mysql-test/t/explain.test: If we have only half a query for EXPLAIN EXTENDED to print (i.e., incomplete subquery info as outer query is illegal), we should provide the user with as much info as we easily can if they ask for it. What we should not do is crash when they come asking for help, that violates etiquette in some countries. sql/item_subselect.cc: If the sub-query's actually set up, print it. Otherwise, elide. --- mysql-test/t/explain.test | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test index 7b7bdd3563c..1b16c811dbd 100644 --- a/mysql-test/t/explain.test +++ b/mysql-test/t/explain.test @@ -147,4 +147,24 @@ EXPLAIN SELECT DISTINCT 1 FROM t1, WHERE t1.a = d1.a; DROP TABLE t1; -# End of 5.0 tests. +--echo # +--echo # Bug#48295: +--echo # explain extended crash with subquery and ONLY_FULL_GROUP_BY sql_mode +--echo # + +CREATE TABLE t1 (f1 INT); + +SELECT @@session.sql_mode INTO @old_sql_mode; +SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; + +# EXPLAIN EXTENDED (with subselect). used to crash. should give NOTICE. +--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS +EXPLAIN EXTENDED SELECT 1 FROM t1 + WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t ); +SHOW WARNINGS; + +SET SESSION sql_mode=@old_sql_mode; + +DROP TABLE t1; + +--echo End of 5.0 tests. -- cgit v1.2.1 From 1d2aeb3da2dedc81a294629b50a6f47a3b377949 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 3 Mar 2010 14:49:03 +0400 Subject: BUG#48265 - MRG_MYISAM problem (works in 5.0.85, does't work in 5.1.40) MERGE engine fails to open child table from a different database if child table/database name contains characters that are subject for table name to filename encoding (WL1324). Another problem is that MERGE engine didn't properly open child table from the same database if child table name contains characters like '/', '#'. The problem was that table name to file name encoding was applied inconsistently: * On CREATE: encode table name + database name if child table is in different database; do not encode table name if child table is in the same database; * No decoding on open. With this fix child table/database names are always encoded on CREATE and decoded on open. Compatibility with older tables preserved. Along with this patch comes fix for SHOW CREATE TABLE, which used to show child table/database path instead of child table/database names. mysql-test/r/merge.result: A test case for BUG#48265. mysql-test/std_data/bug48265.frm: MERGE table from 5.0 to test fix for BUG#48265 compatibility. mysql-test/t/merge.test: A test case for BUG#48265. storage/myisammrg/ha_myisammrg.cc: On CREATE always write child table/database name encoded by table name to filename encoding to dot-MRG file. On open decode child table/database name. Compatibilty with previous versions preserved. Fixed ::append_create_info() to return child table/database name instead of path. storage/myisammrg/myrg_open.c: Move if (has_path) branch from myrg_parent_open() to myisammrg_parent_open_callback. The callback function needs to know if child table was written along with database name to dot-MRG file. Needed for compatibility reasons. --- mysql-test/t/merge.test | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 015ae28c155..d88467cc7a9 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -7,6 +7,8 @@ drop table if exists t1,t2,t3,t4,t5,t6; drop database if exists mysqltest; --enable_warnings +let $MYSQLD_DATADIR= `select @@datadir`; + create table t1 (a int not null primary key auto_increment, message char(20)); create table t2 (a int not null primary key auto_increment, message char(20)); INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1"); @@ -1633,4 +1635,59 @@ SHOW CREATE TRIGGER tr1; DROP TRIGGER tr1; DROP TABLE t1, t2, t3; +--echo # +--echo # BUG#48265 - MRG_MYISAM problem (works in 5.0.85, does't work in 5.1.40) +--echo # +CREATE DATABASE `test/1`; + +CREATE TABLE `test/1`.`t/1`(a INT); +CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`); +SELECT * FROM m1; +SHOW CREATE TABLE m1; +DROP TABLE m1; + +CREATE TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`); +SELECT * FROM `test/1`.m1; +SHOW CREATE TABLE `test/1`.m1; +DROP TABLE `test/1`.m1; +DROP TABLE `test/1`.`t/1`; + +CREATE TEMPORARY TABLE `test/1`.`t/1`(a INT); +CREATE TEMPORARY TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`); +SELECT * FROM m1; +SHOW CREATE TABLE m1; +DROP TABLE m1; + +CREATE TEMPORARY TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`); +SELECT * FROM `test/1`.m1; +SHOW CREATE TABLE `test/1`.m1; +DROP TABLE `test/1`.m1; +DROP TABLE `test/1`.`t/1`; + +DROP DATABASE `test/1`; + +# Test compatibility. Use '@' instead of '/' (was not allowed in 5.0) + +CREATE TABLE `t@1`(a INT); +copy_file std_data/bug48265.frm $MYSQLD_DATADIR/test/m1.frm; +write_file $MYSQLD_DATADIR/test/m1.MRG; +t@1 +EOF +SELECT * FROM m1; +SHOW CREATE TABLE m1; +DROP TABLE `t@1`; + +CREATE DATABASE `test@1`; +CREATE TABLE `test@1`.`t@1`(a INT); +FLUSH TABLE m1; +remove_file $MYSQLD_DATADIR/test/m1.MRG; +write_file $MYSQLD_DATADIR/test/m1.MRG; +./test@1/t@1 +EOF +SELECT * FROM m1; +SHOW CREATE TABLE m1; +DROP TABLE m1; +DROP TABLE `test@1`.`t@1`; +DROP DATABASE `test@1`; + --echo End of 5.1 tests -- cgit v1.2.1 From e46d120e8ef7de8660d10a96f8cfee47e8836b53 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Thu, 4 Mar 2010 12:09:09 +0100 Subject: Bug#48229: group by performance issue of partitioned table Problem was block_size on partitioned tables was not set, resulting in keys_per_block was not correct which affects the cost calculation for read time of indexes (including cost for group min/max).Which resulted in a bad optimizer decision. Fixed by setting stats.block_size correctly. mysql-test/r/partition_range.result: Bug#48229: group by performance issue of partitioned table Added result mysql-test/t/partition_range.test: Bug#48229: group by performance issue of partitioned table Added test sql/ha_partition.cc: Bug#48229: group by performance issue of partitioned table Added missing assignment of stats.block_size. --- mysql-test/t/partition_range.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test index c02d9049f2e..4d011ddc468 100644 --- a/mysql-test/t/partition_range.test +++ b/mysql-test/t/partition_range.test @@ -9,6 +9,24 @@ drop table if exists t1, t2; --enable_warnings +--echo # +--echo # Bug#48229: group by performance issue of partitioned table +--echo # +CREATE TABLE t1 ( + a INT, + b INT, + KEY a (a,b) +) +PARTITION BY HASH (a) PARTITIONS 1; + +# insert some rows (i.e. so that rows/blocks > 1) +INSERT INTO t1 VALUES (0, 580092), (3, 894076), (4, 805483), (4, 913540), (6, 611137), (8, 171602), (9, 599495), (9, 746305), (10, 272829), (10, 847519), (12, 258869), (12, 929028), (13, 288970), (15, 20971), (15, 105839), (16, 788272), (17, 76914), (18, 827274), (19, 802258), (20, 123677), (20, 587729), (22, 701449), (25, 31565), (25, 230782), (25, 442887), (25, 733139), (25, 851020); + +# Before the fix the 'Extra' column showed 'Using index for group-by' +EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100, 3) GROUP BY a; + +DROP TABLE t1; + # # BUG 33429: Succeeds in adding partition when maxvalue on last partition # -- cgit v1.2.1 From 48d986f5110c3eb3d0211c437ee87d965263c674 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Thu, 4 Mar 2010 12:29:22 +0100 Subject: Bug#50104: Partitioned table with just 1 partion works with fk There was no check for foreign keys when altering partitioned tables. Added check for FK when altering partitioned tables. mysql-test/r/partition_innodb.result: Bug#50104: Partitioned table with just 1 partion works with fk Updated test result mysql-test/t/partition_innodb.test: Bug#50104: Partitioned table with just 1 partion works with fk Added test for adding FK on partitioned tables (both 1 and 2 partitions) sql/sql_partition.cc: Bug#50104: Partitioned table with just 1 partion works with fk Disabled adding foreign key when altering a partitioned table. --- mysql-test/t/partition_innodb.test | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index b7fe4477a13..8e92adc5868 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -2,11 +2,38 @@ --source include/have_innodb.inc --disable_warnings -drop table if exists t1; +drop table if exists t1, t2; --enable_warnings let $MYSQLD_DATADIR= `SELECT @@datadir`; +--echo # +--echo # Bug#50104: Partitioned table with just 1 partion works with fk +--echo # +CREATE TABLE t2 ( + id INT, + PRIMARY KEY (id) +) ENGINE=InnoDB ; + +CREATE TABLE t1 ( + id INT NOT NULL AUTO_INCREMENT, + parent_id INT DEFAULT NULL, + PRIMARY KEY (id), + KEY parent_id (parent_id) +) ENGINE=InnoDB; + +ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 1; + +--error ER_FOREIGN_KEY_ON_PARTITIONED +ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id); + +ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 2; + +--error ER_FOREIGN_KEY_ON_PARTITIONED +ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id); + +DROP TABLE t1, t2; + # # Bug#47029: Crash when reorganize partition with subpartition # -- cgit v1.2.1 From 63a88e137365c4158e22c1c8aba7847b5a0ffe86 Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Fri, 5 Mar 2010 23:45:55 +0400 Subject: Bug #39653: find_shortest_key in sql_select.cc does not consider clustered primary keys Choosing a shortest index for the covering index scan, the optimizer ignored the fact, that the clustered primary key read involves whole table data. The find_shortest_key function has been modified to take into account that fact that a clustered PK has a longest key of possible covering indices. mysql-test/r/innodb_mysql.result: Test case for bug #39653. mysql-test/t/innodb_mysql.test: Test case for bug #39653. sql/sql_select.cc: Bug #39653: find_shortest_key in sql_select.cc does not consider clustered primary keys The find_shortest_key function has been modified to take into account that fact that a clustered PK has a longest key of possible covering indices. --- mysql-test/t/innodb_mysql.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index a3c11b8b8d6..75fff9656e2 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -558,4 +558,22 @@ drop table t1,t2; --echo # +--echo # +--echo # Bug #39653: find_shortest_key in sql_select.cc does not consider +--echo # clustered primary keys +--echo # + +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT, f INT, + KEY (b,c)) ENGINE=INNODB; + +INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3), + (4,4,4,4,4,4), (5,5,5,5,5,5), (6,6,6,6,6,6), + (7,7,7,7,7,7), (8,8,8,8,8,8), (9,9,9,9,9,9), + (11,11,11,11,11,11); + +--query_vertical EXPLAIN SELECT COUNT(*) FROM t1 + +DROP TABLE t1; + + --echo End of 5.1 tests -- cgit v1.2.1 From d934426ff5d3e37c69c297677b5ff061e960d731 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Thu, 4 Mar 2010 18:13:08 +0200 Subject: Bug #51357: crash when using handler commands on spatial indexes Spatial indexes were not checking for out-of-record condition in the handler next command when the previous command didn't found rows. Fixed by making the rtree index to check for end of rows condition before re-using the key from the previous search. Fixed another crash if the tree has changed since the last search. Added a test case for the other error. --- mysql-test/t/gis-rtree.test | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test index c325b3bd223..3b341501ab6 100644 --- a/mysql-test/t/gis-rtree.test +++ b/mysql-test/t/gis-rtree.test @@ -902,4 +902,26 @@ SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 DROP TABLE t1; +--echo # +--echo # Bug #51357: crash when using handler commands on spatial indexes +--echo # + +CREATE TABLE t1(a GEOMETRY NOT NULL,SPATIAL INDEX a(a)); +HANDLER t1 OPEN; +HANDLER t1 READ a FIRST; +HANDLER t1 READ a NEXT; +HANDLER t1 READ a PREV; +HANDLER t1 READ a LAST; +HANDLER t1 CLOSE; + +# second crash fixed when the tree has changed since the last search. +HANDLER t1 OPEN; +HANDLER t1 READ a FIRST; +INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); +HANDLER t1 READ a NEXT; +HANDLER t1 CLOSE; + +DROP TABLE t1; + + --echo End of 5.0 tests. -- cgit v1.2.1 From 1f77c7b49a976026522aba4ff766702b7a76346d Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Thu, 4 Mar 2010 18:16:10 +0100 Subject: Bug#50392: insert_id is not reset for partitioned tables auto_increment on duplicate entry The bug was that when INSERT_ID was used and the storage engine was told to release any reserved but not used auto_increment values, it set the highest auto_increment value to INSERT_ID. The fix was to check if the auto_increment value was forced by user (INSERT_ID) or by slave-thread, i.e. not auto- generated. So that it is only allowed to release generated values. mysql-test/r/partition_error.result: Bug#50392: insert_id is not reset for partitioned tables auto_increment on duplicate entry updated result mysql-test/suite/parts/inc/partition_auto_increment.inc: Bug#50392: insert_id is not reset for partitioned tables auto_increment on duplicate entry Added test mysql-test/suite/parts/r/partition_auto_increment_archive.result: Bug#50392: insert_id is not reset for partitioned tables auto_increment on duplicate entry Added result, note that archive does only allow increasing auto_increment values mysql-test/suite/parts/r/partition_auto_increment_blackhole.result: Bug#50392: insert_id is not reset for partitioned tables auto_increment on duplicate entry Added result, note that blackhole accepts all inserts :) mysql-test/suite/parts/r/partition_auto_increment_innodb.result: Bug#50392: insert_id is not reset for partitioned tables auto_increment on duplicate entry Added result, note that innodb rolls back inserts on error, but keeps the auto_increment value. mysql-test/suite/parts/r/partition_auto_increment_memory.result: Bug#50392: insert_id is not reset for partitioned tables auto_increment on duplicate entry Added result, note that memory and myisam inserts all rows before the error. mysql-test/suite/parts/r/partition_auto_increment_myisam.result: Bug#50392: insert_id is not reset for partitioned tables auto_increment on duplicate entry Added result, note that memory and myisam inserts all rows before the error. mysql-test/suite/parts/r/partition_auto_increment_ndb.result: Bug#50392: insert_id is not reset for partitioned tables auto_increment on duplicate entry Added result, note that NDB does not seem to handle INSERT_ID as other engines. (Martin will look into it). mysql-test/t/partition_error.test: Bug#50392: insert_id is not reset for partitioned tables auto_increment on duplicate entry Added test sql/ha_partition.cc: Bug#50392: insert_id is not reset for partitioned tables auto_increment on duplicate entry If the next_insert_id comes from non generated (i.e forced by INSERT_ID or slave-thread) then we cannot lower the reserved auto_increment value, since it have not reserved any values. --- mysql-test/t/partition_error.test | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index 1f011f36257..8da8f54b774 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -8,6 +8,30 @@ drop table if exists t1; --enable_warnings +--echo # +--echo # Bug#50392: insert_id is not reset for partitioned tables +--echo # auto_increment on duplicate entry +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY); +SET INSERT_ID= 13; +INSERT INTO t1 VALUES (NULL); +SET INSERT_ID= 12; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +DROP TABLE t1; +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY(a); +SET INSERT_ID= 13; +INSERT INTO t1 VALUES (NULL); +SET INSERT_ID= 12; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +DROP TABLE t1; + # # Bug#38719: Partitioning returns a different error code for a # duplicate key error -- cgit v1.2.1 From 2ba46ad4fa9a91d4cc91b45da7df7d97024afc51 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 8 Mar 2010 12:39:57 +0200 Subject: Backport of the fix for bug #51357 to 5.0-bugteam.: Spatial indexes were not checking for out-of-record condition in the handler next command when the previous command didn't found rows. Fixed by making the rtree index to check for end of rows condition before re-using the key from the previous search. Fixed another crash if the tree has changed since the last search. Added a test case for the other error. --- mysql-test/t/gis-rtree.test | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test index b5de1ccf248..38d50aecf8f 100644 --- a/mysql-test/t/gis-rtree.test +++ b/mysql-test/t/gis-rtree.test @@ -902,4 +902,26 @@ SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 DROP TABLE t1; +--echo # +--echo # Bug #51357: crash when using handler commands on spatial indexes +--echo # + +CREATE TABLE t1(a GEOMETRY NOT NULL,SPATIAL INDEX a(a)); +HANDLER t1 OPEN; +HANDLER t1 READ a FIRST; +HANDLER t1 READ a NEXT; +HANDLER t1 READ a PREV; +HANDLER t1 READ a LAST; +HANDLER t1 CLOSE; + +# second crash fixed when the tree has changed since the last search. +HANDLER t1 OPEN; +HANDLER t1 READ a FIRST; +INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); +HANDLER t1 READ a NEXT; +HANDLER t1 CLOSE; + +DROP TABLE t1; + + --echo End of 5.0 tests. -- cgit v1.2.1 From d0bb5465b893b23da8e986e3b9b997e71084b82d Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 9 Mar 2010 15:46:27 +0200 Subject: Addendum to the test for bug 51357 : disable the (possibly binary) output from HANDLER ... READ .. NEXT ... --- mysql-test/t/gis-rtree.test | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test index 3b341501ab6..b006096528e 100644 --- a/mysql-test/t/gis-rtree.test +++ b/mysql-test/t/gis-rtree.test @@ -918,7 +918,10 @@ HANDLER t1 CLOSE; HANDLER t1 OPEN; HANDLER t1 READ a FIRST; INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); +--echo # should not crash +--disable_result_log HANDLER t1 READ a NEXT; +--enable_result_log HANDLER t1 CLOSE; DROP TABLE t1; -- cgit v1.2.1 From fd35fc4ea228f38af35d065214fd002b0c09cb71 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 9 Mar 2010 19:00:15 +0200 Subject: Disable the second part of the test for bug #51357 until bug #51877 is fixed. --- mysql-test/t/gis-rtree.test | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test index b006096528e..ffe569cd0f2 100644 --- a/mysql-test/t/gis-rtree.test +++ b/mysql-test/t/gis-rtree.test @@ -914,15 +914,17 @@ HANDLER t1 READ a PREV; HANDLER t1 READ a LAST; HANDLER t1 CLOSE; +#TODO: re-enable this test please when bug #51877 is solved # second crash fixed when the tree has changed since the last search. -HANDLER t1 OPEN; -HANDLER t1 READ a FIRST; -INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); ---echo # should not crash ---disable_result_log -HANDLER t1 READ a NEXT; ---enable_result_log -HANDLER t1 CLOSE; +#HANDLER t1 OPEN; +#HANDLER t1 READ a FIRST; +#INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); +#--echo # should not crash +#--disable_result_log +#HANDLER t1 READ a NEXT; +#--enable_result_log +#HANDLER t1 CLOSE; +#TODO: end of the 51877 dependent section DROP TABLE t1; -- cgit v1.2.1 From 02ac873ccfb5deb46533aefd35640a95f51d1c67 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 9 Mar 2010 18:55:08 -0300 Subject: Bug#51650: crash with user variables and triggers The problem was that bits of the destructive equality propagation optimization weren't being undone after the execution of a stored program. Modifications to the parse tree that are based on transient properties must be undone to enable the re-execution of stored programs. The solution is to cleanup any references to predicates generated by the equality propagation during the execution of a stored program. mysql-test/r/trigger.result: Add test case result for Bug#51650. mysql-test/t/trigger.test: Add test case for Bug#51650. sql/item.cc: Remove reference to a equality predicate. --- mysql-test/t/trigger.test | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 1e55f9d5993..2ab8fa9ba1e 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -2396,4 +2396,34 @@ SELECT * FROM t2; DROP TABLE t1, t2; +--echo # +--echo # Bug#51650 crash with user variables and triggers +--echo # + +--disable_warnings +DROP TRIGGER IF EXISTS trg1; +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (b VARCHAR(50) NOT NULL); +CREATE TABLE t2 (a VARCHAR(10) NOT NULL DEFAULT ''); + +delimiter //; +CREATE TRIGGER trg1 AFTER INSERT ON t2 +FOR EACH ROW BEGIN + SELECT 1 FROM t1 c WHERE + (@bug51650 IS NULL OR @bug51650 != c.b) AND c.b = NEW.a LIMIT 1 INTO @foo; +END// +delimiter ;// + +SET @bug51650 = 1; +INSERT IGNORE INTO t2 VALUES(); +INSERT IGNORE INTO t1 SET b = '777'; +INSERT IGNORE INTO t2 SET a = '111'; +SET @bug51650 = 1; +INSERT IGNORE INTO t2 SET a = '777'; + +DROP TRIGGER trg1; +DROP TABLE t1, t2; + --echo End of 5.1 tests. -- cgit v1.2.1 From f502deac11a36bd070c551725bb0bbb29829e01f Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 9 Mar 2010 07:36:26 -0300 Subject: Bug#40277: SHOW CREATE VIEW returns invalid SQL The problem is that not all column names retrieved from a SELECT statement can be used as view column names due to length and format restrictions. The server failed to properly check the conformity of those automatically generated column names before storing the final view definition on disk. Since columns retrieved from a SELECT statement can be anything ranging from functions to constants values of any format and length, the solution is to rewrite to a pre-defined format any names that are not acceptable as a view column name. The name is rewritten to "Name_exp_%u" where %u translates to the position of the column. To avoid this conversion scheme, define explict names for the view columns via the column_list clause. Also, aliases are now only generated for top level statements. mysql-test/include/view_alias.inc: Add test case for Bug#40277 mysql-test/r/compare.result: Bug#40277: SHOW CREATE VIEW returns invalid SQL mysql-test/r/group_by.result: Bug#40277: SHOW CREATE VIEW returns invalid SQL mysql-test/r/ps.result: Bug#40277: SHOW CREATE VIEW returns invalid SQL mysql-test/r/subselect.result: Bug#40277: SHOW CREATE VIEW returns invalid SQL mysql-test/r/subselect3.result: Bug#40277: SHOW CREATE VIEW returns invalid SQL mysql-test/r/type_datetime.result: Bug#40277: SHOW CREATE VIEW returns invalid SQL mysql-test/r/union.result: Bug#40277: SHOW CREATE VIEW returns invalid SQL mysql-test/r/view.result: Add test case result for Bug#40277 mysql-test/r/view_alias.result: Add test case result for Bug#40277 mysql-test/t/view_alias.test: Add test case for Bug#40277 sql/sql_view.cc: Check if auto generated column names are conforming. Also, the make_unique_view_field_name function is not used as it uses the original name to construct a new one, which does not work if the name is invalid. --- mysql-test/t/view_alias.test | 92 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 mysql-test/t/view_alias.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/view_alias.test b/mysql-test/t/view_alias.test new file mode 100644 index 00000000000..b155ba6c2a9 --- /dev/null +++ b/mysql-test/t/view_alias.test @@ -0,0 +1,92 @@ +--echo # +--echo # Bug#40277 SHOW CREATE VIEW returns invalid SQL +--echo # Bug#41999 SHOW CREATE VIEW returns invalid SQL if subquery is used in SELECT list +--echo # + +--echo # 65 characters exceed the maximum length of a column identifier. The system cannot derive the name from statement. +--echo # Constant with length = 65 . Expect to get the identifier 'Name_exp_1'. +let $after_select= '<--- 65 char including the arrows --->'; +--source include/view_alias.inc +--echo # Subquery with length = 65 . Expect to get the identifier 'Name_exp_1'. +--echo # Attention: Identifier for the column within the subquery will be not generated. +let $after_select= (SELECT '<--- 54 char including the arrows (+ 11 outside) -->'); +--source include/view_alias.inc +--echo # ----------------------------------------------------------------------------------------------------------------- +# +--echo # 64 characters are the maximum length of a column identifier. The system can derive the name from the statement. +let $after_select= '<--- 64 char including the arrows --->'; +--source include/view_alias.inc +let $after_select= (SELECT '<--- 53 char including the arrows (+ 11 outside) --->'); +--source include/view_alias.inc +--echo # ----------------------------------------------------------------------------------------------------------------- +# +--echo # Identifiers must not have trailing spaces. The system cannot derive the name from a constant with trailing space. +--echo # Generated identifiers have at their end the position within the select column list. +--echo # 'c2 ' -> 'Name_exp_1' , ' c4 ' -> 'Name_exp_2' +let $after_select= 'c1', 'c2 ', ' c3', ' c4 '; +--source include/view_alias.inc + +--echo # +--echo # Bug#40277 SHOW CREATE VIEW returns invalid SQL +--echo # + +--disable_warnings +DROP VIEW IF EXISTS v1; +DROP TABLE IF EXISTS t1,t2; +--enable_warnings + +--echo # Column name exceeds the maximum length. +CREATE VIEW v1 AS SELECT '0000000000 1111111111 2222222222 3333333333 4444444444 5555555555'; +let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`; +DROP VIEW v1; +eval CREATE VIEW v1 AS $query; +DROP VIEW v1; + +--echo # Column names with leading trailing spaces. +CREATE VIEW v1 AS SELECT 'c1', 'c2 ', ' c3', ' c4 '; +let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`; +DROP VIEW v1; +eval CREATE VIEW v1 AS $query; +DROP VIEW v1; + +--echo # Column name conflicts with a auto-generated one. +CREATE VIEW v1 AS SELECT 'c1', 'c2 ', ' c3', ' c4 ', 'Name_exp_2'; +let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`; +DROP VIEW v1; +eval CREATE VIEW v1 AS $query; +DROP VIEW v1; + +--echo # Invalid conlumn name in subquery. +CREATE VIEW v1 AS SELECT (SELECT ' c1 '); +let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`; +DROP VIEW v1; +eval CREATE VIEW v1 AS $query; +DROP VIEW v1; + +CREATE TABLE t1(a INT); +CREATE TABLE t2 LIKE t1; + +--echo # Test alias in subquery +CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT 1 FROM t2 AS b WHERE b.a = 0); +let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`; +DROP VIEW v1; +eval CREATE VIEW v1 AS $query; +DROP VIEW v1; + +--echo # Test column alias in subquery +CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT a AS alias FROM t1 GROUP BY alias); +SHOW CREATE VIEW v1; +let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`; +DROP VIEW v1; +eval CREATE VIEW v1 AS $query; +DROP VIEW v1; + +--echo # Alias as the expression column name. +CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT ' a ' AS alias FROM t1 GROUP BY alias); +SHOW CREATE VIEW v1; +let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`; +DROP VIEW v1; +eval CREATE VIEW v1 AS $query; +DROP VIEW v1; + +DROP TABLE t1, t2; -- cgit v1.2.1 From b8132a8d946bde553834c37785bbe53008f1e925 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 12 Mar 2010 10:33:16 +0400 Subject: Bug#41788 mysql_fetch_field returns org_table == table by a view The problem is that Item_direct_view_ref which is inherited from Item_ident updates orig_table_name and table_name with the same values. The fix is introduction of new constructor into Item_ident and up which updates orig_table_name and table_name separately. mysql-test/r/metadata.result: test case mysql-test/t/metadata.test: test case sql/item.cc: new constructor which updates orig_table_name and table_name separately. sql/item.h: new constructor which updates orig_table_name and table_name separately. sql/table.cc: used new constructor --- mysql-test/t/metadata.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test index a10767579fb..9bfb47c53be 100644 --- a/mysql-test/t/metadata.test +++ b/mysql-test/t/metadata.test @@ -129,4 +129,17 @@ SELECT COALESCE(d, d), IFNULL(d, d), IF(i, d, d), DROP TABLE t1; +--echo # +--echo # Bug#41788 mysql_fetch_field returns org_table == table by a view +--echo # + +CREATE TABLE t1 (f1 INT); +CREATE VIEW v1 AS SELECT f1 FROM t1; +--enable_metadata +SELECT f1 FROM v1 va; +--disable_metadata + +DROP VIEW v1; +DROP TABLE t1; + --echo End of 5.0 tests -- cgit v1.2.1 From 81ffd72a5821f07129dedf4c31c3cbc2abfac372 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 9 Mar 2010 09:16:17 -0300 Subject: Bug#51770: UNINSTALL PLUGIN requires no privileges The problem was that UNINSTALL PLUGIN wasn't performing privilege checks before removing a plugin. Any user (including users without any kind of privileges) could uninstall any plugin. The solution is to verify if the user has the DELETE privilege for the mysql.plugin table before uninstalling a plugin. mysql-test/r/plugin_not_embedded.result: Add test case result for Bug#51770. mysql-test/t/plugin_not_embedded-master.opt: Add example plugin path. mysql-test/t/plugin_not_embedded.test: Add test case for Bug#51770. Skip embedded as test relies on privileges checks. --- mysql-test/t/plugin_not_embedded-master.opt | 1 + mysql-test/t/plugin_not_embedded.test | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 mysql-test/t/plugin_not_embedded-master.opt create mode 100644 mysql-test/t/plugin_not_embedded.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/plugin_not_embedded-master.opt b/mysql-test/t/plugin_not_embedded-master.opt new file mode 100644 index 00000000000..367d5233e0e --- /dev/null +++ b/mysql-test/t/plugin_not_embedded-master.opt @@ -0,0 +1 @@ +$EXAMPLE_PLUGIN_OPT diff --git a/mysql-test/t/plugin_not_embedded.test b/mysql-test/t/plugin_not_embedded.test new file mode 100644 index 00000000000..eea7deab40c --- /dev/null +++ b/mysql-test/t/plugin_not_embedded.test @@ -0,0 +1,20 @@ +--source include/not_embedded.inc +--source include/have_example_plugin.inc + +--echo # +--echo # Bug#51770: UNINSTALL PLUGIN requires no privileges +--echo # + +GRANT INSERT ON mysql.plugin TO bug51770@localhost; +connect(con1,localhost,bug51770,,); +eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO; +--error ER_TABLEACCESS_DENIED_ERROR +UNINSTALL PLUGIN example; +connection default; +GRANT DELETE ON mysql.plugin TO bug51770@localhost; +FLUSH PRIVILEGES; +connection con1; +UNINSTALL PLUGIN example; +disconnect con1; +connection default; +DROP USER bug51770@localhost; -- cgit v1.2.1 From 91056475e1f9d64d57d9d2f602575aaad57dcff3 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 10 Mar 2010 12:11:39 +0200 Subject: merged the test disablement because of bug 51357 to 5.0-bugteam --- mysql-test/t/gis-rtree.test | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test index 38d50aecf8f..2497d4ad92a 100644 --- a/mysql-test/t/gis-rtree.test +++ b/mysql-test/t/gis-rtree.test @@ -914,12 +914,14 @@ HANDLER t1 READ a PREV; HANDLER t1 READ a LAST; HANDLER t1 CLOSE; +#TODO: re-enable this test please when bug #51877 is solved # second crash fixed when the tree has changed since the last search. -HANDLER t1 OPEN; -HANDLER t1 READ a FIRST; -INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); -HANDLER t1 READ a NEXT; -HANDLER t1 CLOSE; +#HANDLER t1 OPEN; +#HANDLER t1 READ a FIRST; +#INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); +#HANDLER t1 READ a NEXT; +#HANDLER t1 CLOSE; +#TODO: end of the 51877 dependent section DROP TABLE t1; -- cgit v1.2.1 From 405fd822075488597484ef5ce82a8d3296262130 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 10 Mar 2010 15:04:32 +0400 Subject: BUG#51342 - more xid crashing SET autocommit=1 while XA transaction is active may cause various side effects, including memory corruption and server crash. The problem is that SET autocommit=1 and further queries attempt to commit local transaction, whereas XA transaction is still active. As local and XA transactions are mutually exclusive, this patch forbids enabling autocommit mode while XA transaction is active. mysql-test/r/xa.result: A test case for BUG#51342. mysql-test/t/xa.test: A test case for BUG#51342. sql/set_var.cc: Forbid enabling autocommit mode while XA transaction is active. --- mysql-test/t/xa.test | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test index 04ecf518577..d5def009172 100644 --- a/mysql-test/t/xa.test +++ b/mysql-test/t/xa.test @@ -122,6 +122,22 @@ xa start 'a','c'; --connection default drop table t1; +--echo # +--echo # BUG#51342 - more xid crashing +--echo # +CREATE TABLE t1(a INT) ENGINE=InnoDB; +XA START 'x'; +SET SESSION autocommit=0; +INSERT INTO t1 VALUES(1); +--error ER_XAER_RMFAIL +SET SESSION autocommit=1; +SELECT @@autocommit; +INSERT INTO t1 VALUES(1); +XA END 'x'; +XA COMMIT 'x' ONE PHASE; +DROP TABLE t1; +SET SESSION autocommit=DEFAULT; + --echo End of 5.0 tests # Wait till all disconnects are completed -- cgit v1.2.1 From 29b39e7a4423188d99570b290127a74151805ed5 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Wed, 10 Mar 2010 12:56:05 +0100 Subject: Bug#51830: Incorrect partition pruning on range partition (regression) Problem was that partition pruning did not exclude the last partition if the range was beyond it (i.e. not using MAXVALUE) Fix was to not include the last partition if the partitioning function value was not within the partition range. mysql-test/r/partition_innodb.result: Bug#51830: Incorrect partition pruning on range partition (regression) Updated result mysql-test/r/partition_pruning.result: Bug#51830: Incorrect partition pruning on range partition (regression) Updated result mysql-test/t/partition_innodb.test: Bug#51830: Incorrect partition pruning on range partition (regression) Added test for pruning in InnoDB, since it does not show for MyISAM due to 'Impossible WHERE noticed after reading const tables'. mysql-test/t/partition_pruning.test: Bug#51830: Incorrect partition pruning on range partition (regression) Added test sql/sql_partition.cc: Bug#51830: Incorrect partition pruning on range partition (regression) Also increase the partition id if not inside the last partition (and no MAXVALUE is defined). Added comments and DBUG_ASSERT. --- mysql-test/t/partition_innodb.test | 32 ++++++++++++++++++++++++++++++++ mysql-test/t/partition_pruning.test | 28 ++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index b7fe4477a13..0eec30b69bf 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -7,6 +7,38 @@ drop table if exists t1; let $MYSQLD_DATADIR= `SELECT @@datadir`; +--echo # +--echo # Bug#51830: Incorrect partition pruning on range partition (regression) +--echo # +CREATE TABLE t1 (a INT NOT NULL) +ENGINE = InnoDB +PARTITION BY RANGE(a) +(PARTITION p10 VALUES LESS THAN (10), + PARTITION p30 VALUES LESS THAN (30), + PARTITION p50 VALUES LESS THAN (50), + PARTITION p70 VALUES LESS THAN (70), + PARTITION p90 VALUES LESS THAN (90)); +INSERT INTO t1 VALUES (10),(30),(50); +INSERT INTO t1 VALUES (70); +INSERT INTO t1 VALUES (80); +INSERT INTO t1 VALUES (89); +--error ER_NO_PARTITION_FOR_GIVEN_VALUE +INSERT INTO t1 VALUES (90); +--error ER_NO_PARTITION_FOR_GIVEN_VALUE +INSERT INTO t1 VALUES (100); +--error ER_NO_PARTITION_FOR_GIVEN_VALUE +insert INTO t1 VALUES (110); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100; +DROP TABLE t1; + # # Bug#47029: Crash when reorganize partition with subpartition # diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 315b8393d93..358832496e5 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -702,15 +702,29 @@ insert into t7 values (10),(30),(50); # leftmost intervals explain partitions select * from t7 where a < 5; +explain partitions select * from t7 where a < 9; +explain partitions select * from t7 where a <= 9; +explain partitions select * from t7 where a = 9; +explain partitions select * from t7 where a >= 9; +explain partitions select * from t7 where a > 9; explain partitions select * from t7 where a < 10; explain partitions select * from t7 where a <= 10; explain partitions select * from t7 where a = 10; +explain partitions select * from t7 where a >= 10; +explain partitions select * from t7 where a > 10; #rightmost intervals +explain partitions select * from t7 where a < 89; +explain partitions select * from t7 where a <= 89; +explain partitions select * from t7 where a = 89; +explain partitions select * from t7 where a > 89; +explain partitions select * from t7 where a >= 89; explain partitions select * from t7 where a < 90; +explain partitions select * from t7 where a <= 90; explain partitions select * from t7 where a = 90; explain partitions select * from t7 where a > 90; explain partitions select * from t7 where a >= 90; +explain partitions select * from t7 where a > 91; # misc intervals explain partitions select * from t7 where a > 11 and a < 29; @@ -728,15 +742,29 @@ insert into t7 values (10),(30),(50); # leftmost intervals explain partitions select * from t7 where a < 5; +explain partitions select * from t7 where a < 9; +explain partitions select * from t7 where a <= 9; +explain partitions select * from t7 where a = 9; +explain partitions select * from t7 where a >= 9; +explain partitions select * from t7 where a > 9; explain partitions select * from t7 where a < 10; explain partitions select * from t7 where a <= 10; explain partitions select * from t7 where a = 10; +explain partitions select * from t7 where a >= 10; +explain partitions select * from t7 where a > 10; #rightmost intervals +explain partitions select * from t7 where a < 89; +explain partitions select * from t7 where a <= 89; +explain partitions select * from t7 where a = 89; +explain partitions select * from t7 where a > 89; +explain partitions select * from t7 where a >= 89; explain partitions select * from t7 where a < 90; +explain partitions select * from t7 where a <= 90; explain partitions select * from t7 where a = 90; explain partitions select * from t7 where a > 90; explain partitions select * from t7 where a >= 90; +explain partitions select * from t7 where a > 91; # misc intervals explain partitions select * from t7 where a > 11 and a < 29; -- cgit v1.2.1 From 2a667b7bcbd8be59f9eb04fe6d3d6d4099baa2c2 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 10 Mar 2010 19:28:49 +0400 Subject: An addition to fix for BUG#51342 - more xid crashing Restore autocommit variable by supplying explicit value. mysql-test/r/xa.result: Restore autocommit variable by supplying explicit value. mysql-test/t/xa.test: Restore autocommit variable by supplying explicit value. --- mysql-test/t/xa.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test index d5def009172..4871aea30e9 100644 --- a/mysql-test/t/xa.test +++ b/mysql-test/t/xa.test @@ -136,7 +136,7 @@ INSERT INTO t1 VALUES(1); XA END 'x'; XA COMMIT 'x' ONE PHASE; DROP TABLE t1; -SET SESSION autocommit=DEFAULT; +SET SESSION autocommit=1; --echo End of 5.0 tests -- cgit v1.2.1 From dcc5b43b35ace09f8a1ba6d0300f5dd17847b6d2 Mon Sep 17 00:00:00 2001 From: Martin Hansson Date: Wed, 10 Mar 2010 17:10:05 +0100 Subject: Bug#50545: Single table UPDATE IGNORE crashes on join view in sql_safe_updates mode. This bug was unexpectedly fixed along with bug number 49534. This patch contains only the test case. --- mysql-test/t/update.test | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 02e8763a630..f6708828a6b 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -467,3 +467,19 @@ UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9; ALTER TABLE t2 COMMENT = 'DEF'; DROP TABLE t1, t2; + +--echo # +--echo # Bug#50545: Single table UPDATE IGNORE crashes on join view in +--echo # sql_safe_updates mode. +--echo # +CREATE TABLE t1 ( a INT, KEY( a ) ); +INSERT INTO t1 VALUES (0), (1); +CREATE VIEW v1 AS SELECT t11.a, t12.a AS b FROM t1 t11, t1 t12; +SET SESSION sql_safe_updates = 1; + +--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE +UPDATE IGNORE v1 SET a = 1; + +SET SESSION sql_safe_updates = DEFAULT; +DROP TABLE t1; +DROP VIEW v1; -- cgit v1.2.1 From e0aadfd491700fc072ffee1e1612f52fa5fc39b1 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 12 Mar 2010 14:43:30 +0400 Subject: BUG#47444 - --myisam_repair_threads>1can result in all index cardinalities=1 Parallel repair didn't poroperly update index cardinality in certain cases. When myisam_sort_buffer_size is not enough to store all keys, index cardinality was updated before index was actually written, when no index statistic is available. mysql-test/r/myisam.result: A test case for BUG#47444. mysql-test/t/myisam.test: A test case for BUG#47444. storage/myisam/sort.c: update_key_parts() must be called after all index entries are written, when index statistic is available. --- mysql-test/t/myisam.test | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 7dcfe058039..4abd7dd2b1b 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1631,4 +1631,18 @@ INSERT INTO t1 VALUES('1'); SELECT * FROM t1, t1 AS a1 WHERE t1.a=1 AND a1.a=1; DROP TABLE t1; +--echo # +--echo # BUG#47444 - --myisam_repair_threads>1can result in all index +--echo # cardinalities=1 +--echo # +SET myisam_repair_threads=2; +SET myisam_sort_buffer_size=4096; +CREATE TABLE t1(a CHAR(255), KEY(a), KEY(a), KEY(a)); +INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(0),(1),(2),(3); +REPAIR TABLE t1; +SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; +DROP TABLE t1; +SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; +SET myisam_repair_threads=@@global.myisam_repair_threads; + --echo End of 5.1 tests -- cgit v1.2.1 From 4c205a65fb9761a4e667ba157730432ef26c9ea9 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Sat, 13 Mar 2010 18:32:42 -0300 Subject: Post-merge fix: remove unnecessary flush privileges. --- mysql-test/t/plugin_not_embedded.test | 1 - 1 file changed, 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/plugin_not_embedded.test b/mysql-test/t/plugin_not_embedded.test index eea7deab40c..339d28fb236 100644 --- a/mysql-test/t/plugin_not_embedded.test +++ b/mysql-test/t/plugin_not_embedded.test @@ -12,7 +12,6 @@ eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO; UNINSTALL PLUGIN example; connection default; GRANT DELETE ON mysql.plugin TO bug51770@localhost; -FLUSH PRIVILEGES; connection con1; UNINSTALL PLUGIN example; disconnect con1; -- cgit v1.2.1 From 57a96c77dbd136b5f31f610d0270d7d7b111ddbb Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Sun, 14 Mar 2010 08:16:59 -0300 Subject: Post-merge fix: replace plugin extension output. --- mysql-test/t/plugin_not_embedded.test | 1 + 1 file changed, 1 insertion(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/plugin_not_embedded.test b/mysql-test/t/plugin_not_embedded.test index 339d28fb236..15aff548c29 100644 --- a/mysql-test/t/plugin_not_embedded.test +++ b/mysql-test/t/plugin_not_embedded.test @@ -7,6 +7,7 @@ GRANT INSERT ON mysql.plugin TO bug51770@localhost; connect(con1,localhost,bug51770,,); +--replace_regex /\.dll/.so/ eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO; --error ER_TABLEACCESS_DENIED_ERROR UNINSTALL PLUGIN example; -- cgit v1.2.1 From 0ed46845479e5d1f995ee6c16cdad7dd4cb43317 Mon Sep 17 00:00:00 2001 From: Martin Hansson Date: Tue, 16 Mar 2010 10:20:07 +0100 Subject: Bug#50918: Date columns treated differently in Views than in Base Tables The type inferrence of a view column caused the result to be interpreted as the wrong type: DATE colums were interpreted as TIME and TIME as DATETIME. This happened because view columns are represented by Item_ref objects as opposed to Item_field's. Item_ref had no method for retrieving a TIME value and thus was forced to depend on the default implementation for any expression, which caused the expression to be evaluated as a string and then parsed into a TIME/DATETIME value. Fixed by letting Item_ref classes forward the request for a TIME value to the referred Item - which is a field in this case - this reads the TIME value directly without conversion. --- mysql-test/t/type_date.test | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index aec60bc2dee..899f912a5a5 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -246,4 +246,24 @@ insert into t1 values ('0000-01-01'), ('0000-00-01'), ('0001-01-01'); select * from t1 where a between '0000-00-01' and '0000-00-02'; drop table t1; +--echo # +--echo # Bug#50918: Date columns treated differently in Views than in Base +--echo # Tables +--echo # +CREATE TABLE t1 ( the_date DATE, the_time TIME ); +INSERT INTO t1 VALUES ( '2010-01-01', '01:01:01' ); + +SELECT * FROM t1 t11 JOIN t1 t12 ON addtime( t11.the_date, t11.the_time ) = + addtime( t12.the_date, t12.the_time ); + +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT * FROM t1 JOIN v1 ON addtime( t1.the_date, t1.the_time ) = + addtime( v1.the_date, v1.the_time ); + +SELECT * FROM t1 JOIN v1 ON addtime( t1.the_date, t1.the_time ) = + addtime( cast(v1.the_date AS DATETIME), v1.the_time ); + +DROP TABLE t1; +DROP VIEW v1; + --echo End of 5.1 tests -- cgit v1.2.1 From a117dfb087459000b4ebc13cd3a83842dc4b8897 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 16 Mar 2010 13:38:35 +0100 Subject: fixes for the status_user.test in ps protocol sql/sql_class.cc: reset userstat_running after the data were colleced to prevent double accounting. don't assert for COM_QUERY, many more are possible. don't update_stats() here, it's too late, lex->sql_command may be already reset sql/sql_parse.cc: update_stats() here, when the current arena is still valid --- mysql-test/t/status_user.test | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/status_user.test b/mysql-test/t/status_user.test index 1c011828237..f0e236dec98 100644 --- a/mysql-test/t/status_user.test +++ b/mysql-test/t/status_user.test @@ -66,16 +66,8 @@ select * from information_schema.index_statistics; select * from information_schema.table_statistics; show table_statistics; show index_statistics; -select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, - ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, - UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, - ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, - ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics; -select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, - ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, - UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, - ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, - ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics; +--query_vertical select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics; +--query_vertical select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics; flush table_statistics; flush index_statistics; select * from information_schema.index_statistics; -- cgit v1.2.1 From 7dc693229fc90dbd9c7744435483cbe1a0767c56 Mon Sep 17 00:00:00 2001 From: Martin Hansson Date: Tue, 16 Mar 2010 15:51:00 +0100 Subject: Bug#47762: Incorrect result from MIN() when WHERE tests NOT NULL column for NULL The optimization to read MIN() and MAX() values from an index did not properly handle comparisons with NULL values. Fixed by giving up the particular optimization step if there are non-NULL safe comparisons with NULL values, as the result is NULL anyway. Also, Oracle copyright notice was added to all files. --- mysql-test/t/group_min_max.test | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index df385dfa7d2..6aec0e3677f 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -1054,4 +1054,23 @@ SELECT 1 AS c, b FROM t1 WHERE b IN (1,2) GROUP BY c, b; SELECT a FROM t1 WHERE b=1; DROP TABLE t1; +--echo # +--echo # Bug#47762: Incorrect result from MIN() when WHERE tests NOT NULL column +--echo # for NULL +--echo # + +--echo ## Test for NULLs allowed +CREATE TABLE t1 ( a INT, KEY (a) ); +INSERT INTO t1 VALUES (1), (2), (3); +--source include/min_null_cond.inc +INSERT INTO t1 VALUES (NULL), (NULL); +--source include/min_null_cond.inc +DROP TABLE t1; + +--echo ## Test for NOT NULLs +CREATE TABLE t1 ( a INT NOT NULL PRIMARY KEY); +INSERT INTO t1 VALUES (1), (2), (3); +--source include/min_null_cond.inc +DROP TABLE t1; + --echo End of 5.1 tests -- cgit v1.2.1 From ae49d9710b791d1eaf7f552a44067c5108bd8c85 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 17 Mar 2010 16:18:46 +0200 Subject: Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may corrupt definition at engine If a single ALTER TABLE contains both DROP INDEX and ADD INDEX using the same index name (a.k.a. index modification) we need to disable in-place alter table because we can't ask the storage engine to have two copies of the index with the same name even temporarily (if we first do the ADD INDEX and then DROP INDEX) and we can't modify indexes that are needed by e.g. foreign keys if we first do DROP INDEX and then ADD INDEX. Fixed the problem by disabling in-place ALTER TABLE for these cases. --- mysql-test/t/innodb_mysql.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 75fff9656e2..88ca8d42e3d 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -575,5 +575,18 @@ INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3), DROP TABLE t1; +--echo # +--echo # Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may +--echo # corrupt definition at engine +--echo # + +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, KEY k (a,b)) + ENGINE=InnoDB; + +ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b); + +--query_vertical SHOW INDEXES FROM t1; + +DROP TABLE t1; --echo End of 5.1 tests -- cgit v1.2.1 From b4537076808b939d3d6869ba31bf6c59f16fec0e Mon Sep 17 00:00:00 2001 From: "John H. Embretsen" Date: Thu, 18 Mar 2010 11:26:27 +0100 Subject: Bug#52060 - test udf fails on Snow Leopard reverse DNS lookup of "localhost" returns "broadcasthost" on Snow Leopard, and NULL on most others. Simply ignore the output, as this is not an essential part of UDF testing. --- mysql-test/t/udf.test | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test index 7bf252040e5..9295969c05f 100644 --- a/mysql-test/t/udf.test +++ b/mysql-test/t/udf.test @@ -51,14 +51,17 @@ select lookup("localhost"); --error ER_CANT_INITIALIZE_UDF select reverse_lookup(); -# These two functions should return "localhost", but it's +# These two function calls should return "localhost", but it's # depending on configuration, so just call them and don't log the result --disable_result_log select reverse_lookup("127.0.0.1"); select reverse_lookup(127,0,0,1); ---enable_result_log +# This function call may return different results depending on platform, +# so ignore results (see Bug#52060). select reverse_lookup("localhost"); +--enable_result_log + --error ER_CANT_INITIALIZE_UDF select avgcost(); --error ER_CANT_INITIALIZE_UDF -- cgit v1.2.1 From caa1ccb0c324bca664112a5562f174f603e0a0b7 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 19 Mar 2010 10:01:02 +0400 Subject: Bug#51494 crash with join, explain and 'sounds like' operator The crash happens because of discrepancy between values of conts_tables and join->const_table_map(make_join_statisctics). Calculation of conts_tables used condition with HA_STATS_RECORDS_IS_EXACT flag check. Calculation of join->const_table_map does not use this flag check. In case of MERGE table without union with index the table does not become const table and thus join_read_const_table() is not called for the table. join->const_table_map supposes this table is const and later in make_join_select this table is used for making&calculation const condition. As table record buffer is not populated it leads to crash. The fix is adding a check if an engine supports HA_STATS_RECORDS_IS_EXACT flag before updating join->const_table_map. mysql-test/r/merge.result: test result mysql-test/t/merge.test: test case sql/sql_select.cc: adding a check if an engine supports HA_STATS_RECORDS_IS_EXACT flag before updating join->const_table_map. --- mysql-test/t/merge.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index d88467cc7a9..44b202fab97 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -1690,4 +1690,19 @@ DROP TABLE m1; DROP TABLE `test@1`.`t@1`; DROP DATABASE `test@1`; +--echo # +--echo # Bug#51494c rash with join, explain and 'sounds like' operator +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MYISAM; +INSERT INTO t1 VALUES(1); + +CREATE TABLE t2 (b INT NOT NULL,c INT,d INT,e BLOB NOT NULL, +KEY idx0 (d, c)) ENGINE=MERGE; + +EXPLAIN SELECT * FROM t1 NATURAL RIGHT JOIN +t2 WHERE b SOUNDS LIKE e AND d = 1; + +DROP TABLE t2, t1; + --echo End of 5.1 tests -- cgit v1.2.1 From d1c2e8508fcc795eb5aeafe1af492929ec13ee97 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 19 Mar 2010 10:21:37 +0400 Subject: Bug#51598 Inconsistent behaviour with a COALESCE statement inside an IN comparison Optimizer erroneously translated LEFT JOIN into INNER JOIN. It leads to cutting rows with NULL right side. It happens because Item_row uses not_null_tables() method form the base(Item) class and does not calculate 'null tables' properly. The fix is adding calculation of 'not null tables' to Item_row. mysql-test/r/join_outer.result: test result mysql-test/t/join_outer.test: test case sql/item_row.cc: adding calculation of 'not null tables' to Item_row. sql/item_row.h: adding calculation of 'not null tables' to Item_row. --- mysql-test/t/join_outer.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index aeaa69657c6..e3d68d71603 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -896,3 +896,21 @@ FROM t1 JOIN t2 USING( a ) GROUP BY t1.a WITH ROLLUP; DROP TABLE t1, t2; + +--echo # +--echo # Bug#51598 Inconsistent behaviour with a COALESCE statement inside an IN comparison +--echo # +CREATE TABLE t1(f1 INT, f2 INT, f3 INT); +INSERT INTO t1 VALUES (1, NULL, 3); +CREATE TABLE t2(f1 INT, f2 INT); +INSERT INTO t2 VALUES (2, 1); + +EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2 +WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2)); + +SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2 +WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2)); + +DROP TABLE t1, t2; + +--echo End of 5.1 tests -- cgit v1.2.1 From a76b8f9a1d58991f58771043034308895b368549 Mon Sep 17 00:00:00 2001 From: Martin Hansson Date: Fri, 19 Mar 2010 09:23:44 +0100 Subject: Post-push fix to disable a subset of the test case for Bug#47762. This has been back-ported from 6.0 as the problems proved to afflict 5.1 as well. The fix exposed two new bugs. They were reported as follows. Bug no 52174: Sometimes wrong plan when reading a MAX value from non-NULL index Bug no 52173: Reading NULL value from non-NULL index gives wrong result in embedded server Both bugs taken together affect a much smaller class of queries than #47762, so the fix stays for now. --- mysql-test/t/group_min_max.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index 6aec0e3677f..b06f0c09fc5 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -1070,6 +1070,18 @@ DROP TABLE t1; --echo ## Test for NOT NULLs CREATE TABLE t1 ( a INT NOT NULL PRIMARY KEY); INSERT INTO t1 VALUES (1), (2), (3); +--echo # +--echo # NULL-safe operator test disabled for non-NULL indexed columns. +--echo # +--echo # See bugs +--echo # +--echo # - Bug#52173: Reading NULL value from non-NULL index gives +--echo # wrong result in embedded server +--echo # +--echo # - Bug#52174: Sometimes wrong plan when reading a MAX value from +--echo # non-NULL index +--echo # +--let $skip_null_safe_test= 1 --source include/min_null_cond.inc DROP TABLE t1; -- cgit v1.2.1 From ad6e00e3b2b9bf26805c90cbd7655c6d2b20cab4 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 19 Mar 2010 13:09:22 +0400 Subject: Bug#51242 HAVING clause on table join produce incorrect results The problem is that when we make conditon for grouped result const part of condition is cut off. It happens because some parts of 'having' condition which refer to outer join become const after make_join_statistics. These parts may be lost during further having condition transformation in JOIN::exec. The fix is adding 'having' condition check for const tables after make_join_statistics is performed. mysql-test/r/having.result: test case mysql-test/t/having.test: test result sql/sql_select.cc: added 'having' condition check for const tables after make_join_statistics is performed. --- mysql-test/t/having.test | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 185ca4bdddb..b68ba69b975 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -467,5 +467,35 @@ ORDER BY t1.id1; DROP TABLE t1; +--echo # +--echo # Bug#48916 Server incorrectly processing HAVING clauses with an ORDER BY clause +--echo # +CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT, f3 INT); +INSERT INTO t1 VALUES (2,7,9), (4,7,9), (6,2,9), (17,0,9); + +SELECT table1.f1, table2.f2 +FROM t1 AS table1 +JOIN t1 AS table2 ON table1.f3 = table2.f3 +WHERE table2.f1 = 2 +GROUP BY table1.f1, table2.f2 +HAVING (table2.f2 = 8 AND table1.f1 >= 6); + +EXPLAIN EXTENDED +SELECT table1.f1, table2.f2 +FROM t1 AS table1 +JOIN t1 AS table2 ON table1.f3 = table2.f3 +WHERE table2.f1 = 2 +GROUP BY table1.f1, table2.f2 +HAVING (table2.f2 = 8 AND table1.f1 >= 6); + +EXPLAIN EXTENDED +SELECT table1.f1, table2.f2 +FROM t1 AS table1 +JOIN t1 AS table2 ON table1.f3 = table2.f3 +WHERE table2.f1 = 2 +GROUP BY table1.f1, table2.f2 +HAVING (table2.f2 = 8); + +DROP TABLE t1; --echo End of 5.0 tests -- cgit v1.2.1 From b0ce621d137367e6401d2273e74ff5b66f315d54 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 21 Mar 2010 21:58:19 +0100 Subject: status_user.test fix for rbr --- mysql-test/t/status_user.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/status_user.test b/mysql-test/t/status_user.test index f0e236dec98..d42f81b20e5 100644 --- a/mysql-test/t/status_user.test +++ b/mysql-test/t/status_user.test @@ -22,7 +22,7 @@ set @@global.general_log=0; set @@global.userstat=1; flush status; -create table t1 (a int, primary key (a), b int default 0) engine=myisam; +create table t1 (a int, primary key (a), b int default 0) engine=innodb; insert into t1 (a) values (1),(2),(3),(4); update t1 set b=1; update t1 set b=5 where a=2; -- cgit v1.2.1 From 8feadddbe437556fe4f8c054fa9c749f77dd20ca Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Mon, 22 Mar 2010 12:33:25 +0400 Subject: Bug #49910: Behavioural change in SELECT/WHERE on YEAR(4) data type (Original patch by Sinisa Milivojevic) The YEAR(4) value of 2000 was equal to the "bad" YEAR(4) value of 0000. The get_year_value() function has been modified to not adjust bad YEAR(4) value to 2000. mysql-test/r/type_year.result: Test case for bug #49910. mysql-test/t/type_year.test: Test case for bug #49910. sql/item_cmpfunc.cc: Bug #49910: Behavioural change in SELECT/WHERE on YEAR(4) data type The get_year_value() function has been modified to not adjust bad YEAR(4) value to 2000. --- mysql-test/t/type_year.test | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test index 16fd39a59d8..d8da4ccc82c 100644 --- a/mysql-test/t/type_year.test +++ b/mysql-test/t/type_year.test @@ -133,6 +133,22 @@ SELECT * FROM t4 WHERE yyyy > 123; DROP TABLE t2, t4; +--echo # +--echo # Bug #49910: Behavioural change in SELECT/WHERE on YEAR(4) data type +--echo # + +CREATE TABLE t1 (y YEAR NOT NULL, s VARCHAR(4)); +INSERT INTO t1 (s) VALUES ('bad'); +INSERT INTO t1 (y, s) VALUES (0, 0), (2000, 2000), (2001, 2001); + +SELECT * FROM t1 ta, t1 tb WHERE ta.y = tb.y; +SELECT * FROM t1 WHERE t1.y = 0; +SELECT * FROM t1 WHERE t1.y = 2000; + +SELECT ta.y AS ta_y, ta.s, tb.y AS tb_y, tb.s FROM t1 ta, t1 tb HAVING ta_y = tb_y; + +DROP TABLE t1; + --echo # --echo End of 5.1 tests -- cgit v1.2.1 From 84fc3da40fc1244d4ee39db43dcf226e100e0724 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 22 Mar 2010 16:27:59 +0400 Subject: Bug #51976 LDML collations issue Problem: caseup_multiply and casedn_multiply members were not initialized for a dynamic collation, so UPPER() and LOWER() functions returned empty strings. Fix: initializing the members properly. Adding tests: mysql-test/r/ctype_ldml.result mysql-test/t/ctype_ldml.test Applying the fix: mysys/charset.c --- mysql-test/t/ctype_ldml.test | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/ctype_ldml.test b/mysql-test/t/ctype_ldml.test index 0395de273de..9ab458ba516 100644 --- a/mysql-test/t/ctype_ldml.test +++ b/mysql-test/t/ctype_ldml.test @@ -45,6 +45,14 @@ INSERT INTO t1 (a) VALUES ('hello!'); SELECT * FROM t1 WHERE LOWER(a)=LOWER('N'); DROP TABLE t1; +--echo # +--echo # Bug#51976 LDML collations issue (cyrillic example) +--echo # +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci); +INSERT INTO t1 (a) VALUES ('Hello'); +SELECT a, UPPER(a), LOWER(a) FROM t1; +DROP TABLE t1; + --echo # --echo # Bug#43827 Server closes connections and restarts --echo # -- cgit v1.2.1 From b602127bf0225b7a33b44c1d7c7e1f06f8f4dee7 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Mon, 22 Mar 2010 16:30:27 +0400 Subject: BUG#51868 - crash with myisam_use_mmap and partitioned myisam tables Queries following TRUNCATE of partitioned MyISAM table may crash server if myisam_use_mmap is true. Internally this is MyISAM bug, but limited to partitioned tables, because MyISAM doesn't use ::delete_all_rows() method for TRUNCATE, but goes via table recreate instead. MyISAM didn't properly fall back to non-mmaped I/O after mmap() failure. Was not repeatable on linux before, likely because (quote from man mmap): SUSv3 specifies that mmap() should fail if length is 0. However, in kernels before 2.6.12, mmap() succeeded in this case: no mapping was created and the call returned addr. Since kernel 2.6.12, mmap() fails with the error EINVAL for this case. mysql-test/r/partition.result: A test case for BUG#51868. mysql-test/t/partition.test: A test case for BUG#51868. storage/myisam/mi_delete_all.c: _mi_unmap_file() is compressed record format specific, which is read-only. As compressed MyISAM data files are read-only, we must never use _mi_unmap_file() in mi_delete_all_rows(). storage/myisam/mi_dynrec.c: Make myisam mmap code more durable to errors: - set file_read/file_write handlers if mmap succeeded; - reset file_read/file_write handlers on unmap. storage/myisam/mi_extra.c: Moved file_read/file_write handlers initialization to mi_dynmap_file(). storage/myisam/myisamdef.h: Added mi_munmap_file() declaration. --- mysql-test/t/partition.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 0cbe389dadd..22124cc1847 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -2081,4 +2081,17 @@ INSERT INTO t1 VALUES (6,8,10); SELECT 1 FROM t1 JOIN t1 AS t2 USING (a) FOR UPDATE; DROP TABLE t1; + +--echo # +--echo # BUG#51868 - crash with myisam_use_mmap and partitioned myisam tables +--echo # +SET GLOBAL myisam_use_mmap=1; +CREATE TABLE t1(a INT) PARTITION BY HASH(a) PARTITIONS 1; +INSERT INTO t1 VALUES(0); +FLUSH TABLE t1; +TRUNCATE TABLE t1; +INSERT INTO t1 VALUES(0); +DROP TABLE t1; +SET GLOBAL myisam_use_mmap=default; + --echo End of 5.1 tests -- cgit v1.2.1 From 28e95ba535e175dc696fe7a739736ae9bf2a2b36 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Mon, 29 Mar 2010 03:32:30 +0100 Subject: Bug#48525: trigger changes "Column 'id' cannot be null" behaviour CHECK_FIELD_IGNORE was treated as CHECK_FIELD_ERROR_FOR_NULL; UPDATE...SET...NULL on NOT NULL fields behaved differently after a trigger. Now distinguishes between IGNORE and ERROR_FOR_NULL and save/restores check-field options. mysql-test/r/trigger.result: Show that UPDATE...SET...NULL on NOT NULL columns doesn't behave differently when run after a trigger. mysql-test/t/trigger.test: Show that UPDATE...SET...NULL on NOT NULL columns doesn't behave differently when run after a trigger. sql/field_conv.cc: CHECK_FIELD_IGNORE was treated as CHECK_FIELD_ERROR_FOR_NULL. Distinguish between the two. sql/sp_head.cc: Raise error as needed. sql/sql_class.cc: Save and restore check-fields options. sql/sql_class.h: Make room so we can save check-fields options. sql/sql_insert.cc: Raise error as needed. --- mysql-test/t/trigger.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 2ab8fa9ba1e..368271f1fb2 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -2426,4 +2426,17 @@ INSERT IGNORE INTO t2 SET a = '777'; DROP TRIGGER trg1; DROP TABLE t1, t2; +# +# Bug #48525: trigger changes "Column 'id' cannot be null" behaviour +# +CREATE TABLE t1 (id INT NOT NULL); +CREATE TABLE t2 (id INT NOT NULL); +INSERT t1 VALUES (1),(2),(3); +UPDATE t1 SET id=NULL; +CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW + INSERT INTO t2 VALUES (3); +UPDATE t1 SET id=NULL; +DROP TRIGGER t1_bu; +DROP TABLE t1,t2; + --echo End of 5.1 tests. -- cgit v1.2.1 From 5167451a92cfd070713be4d57e211ea483a8826b Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 23 Mar 2010 16:54:16 +0200 Subject: Bug #51893: crash with certain characters given to load_file function on windows When making sure that the directory path ends up with a slash/backslash we need to check for the correct length of the buffer and trim at the appropriate location so we don't write past the end of the buffer. --- mysql-test/t/loaddata.test | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index a32fee6b46e..45a55ed3243 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -547,4 +547,12 @@ let $MYSQLD_DATADIR= `select @@datadir`; remove_file $MYSQLD_DATADIR/test/t1.txt; +--echo # +--echo # Bug #51893: crash with certain characters given to load_file +--echo # function on windows +--echo # + +select load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A); + + --echo End of 5.1 tests -- cgit v1.2.1 From a9a2ceae1f360c275ed4db5b093ab65be4f5fb7b Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 23 Mar 2010 17:07:00 +0200 Subject: Bug #51850: crash/memory overlap when using load data infile and set col equal to itself! There's no need to copy the value of a field into itself. While generally harmless (except for some performance penalties) it may be dangerous when the copy code doesn't expect this. Fixed by checking if the source field is the same as the destination field before copying the data. Note that we must preserve the order of assignment of the null flags (hence the null_value assignment addition). --- mysql-test/t/loaddata.test | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 7bfe2491c7c..a32fee6b46e 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -532,5 +532,19 @@ SET character_set_filesystem=default; select @@character_set_filesystem; +--echo # +--echo # Bug #51850: crash/memory overlap when using load data infile and set +--echo # col equal to itself! +--echo # + +CREATE TABLE t1(col0 LONGBLOB); +SELECT 'test' INTO OUTFILE 't1.txt'; +LOAD DATA INFILE 't1.txt' IGNORE INTO TABLE t1 SET col0=col0; +SELECT * FROM t1; + +DROP TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/t1.txt; + --echo End of 5.1 tests -- cgit v1.2.1 From bccf219bfc61bb45d334b40d732651eb9bef5075 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 24 Mar 2010 14:37:28 +0400 Subject: Bug#48483 crash in get_best_combination() The crash happens because greedy_serach can not determine best plan due to wrong inner table dependences. These dependences affects join table sorting which performs before greedy_search starting. In our case table which has real 'no dependences' should be put on top of the list but it does not happen as inner tables have no dependences as well. The fix is to exclude RAND_TABLE_BIT mask from condition which checks if table dependences should be updated. mysql-test/r/join.result: test result mysql-test/t/join.test: test case sql/sql_select.cc: RAND_TABLE_BIT mask should not be counted as it prevents update of inner table dependences. For example it might happen if RAND() function is used in JOIN ON clause. --- mysql-test/t/join.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 5b91d89836c..ba61da289bc 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -713,4 +713,16 @@ FROM DROP TABLE t1,t2,t3,t4,t5,t6; +--echo # +--echo # Bug#48483: crash in get_best_combination() +--echo # + +CREATE TABLE t1(f1 INT); +INSERT INTO t1 VALUES (1),(2); +CREATE VIEW v1 AS SELECT 1 FROM t1 LEFT JOIN t1 AS t2 on 1=1; +EXPLAIN EXTENDED +SELECT 1 FROM v1 right join v1 AS v2 ON RAND(); +DROP VIEW v1; +DROP TABLE t1; + --echo End of 5.0 tests. -- cgit v1.2.1 From ea7d830ad2c5715597d2d7e55215263f0fd8ba7c Mon Sep 17 00:00:00 2001 From: Kristofer Pettersson Date: Wed, 24 Mar 2010 17:37:41 +0100 Subject: Bug#46615 Assertion in Query_cache::invalidate in INSERT in a VIEW of a MERGE table If the listed columns in the view definition of the table used in a 'INSERT .. SELECT ..' statement mismatched, a debug assertion would trigger in the cache invalidation code following the failing statement. Although the find_field_in_view() function correctly generated ER_BAD_FIELD_ERROR during setup_fields(), the error failed to propagate further than handle_select(). This patch fixes the issue by adding a check for the return value. mysql-test/r/query_cache_with_views.result: * added test for bug 46615 mysql-test/t/query_cache_with_views.test: * added test for bug 46615 sql/sql_parse.cc: * added check for handle_select() return code before attempting to invalidate the cache. --- mysql-test/t/query_cache_with_views.test | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/query_cache_with_views.test b/mysql-test/t/query_cache_with_views.test index d4ebe45b7ac..97e37c53aa3 100644 --- a/mysql-test/t/query_cache_with_views.test +++ b/mysql-test/t/query_cache_with_views.test @@ -126,5 +126,22 @@ show status like "Qcache_inserts"; show status like "Qcache_hits"; drop table t1; +--echo # +--echo # Bug46615 Assertion in Query_cache::invalidate in INSERT in a VIEW of a MERGE table +--echo # +CREATE TABLE t1 (c1 INT, c2 INT); +CREATE TABLE t2 LIKE t1; +SET AUTOCOMMIT=OFF; +CREATE VIEW t1_view AS SELECT c1 FROM t1 NATURAL JOIN t2 ; +# Before the bug patch the below INSERT stmt used to +# crash when other fields than the ones listed in the +# view definition were used. +--error ER_BAD_FIELD_ERROR +INSERT INTO t1_view (c1, c2) SELECT c1, c2 FROM t1; +DROP TABLE t1; +DROP TABLE t2; +DROP VIEW t1_view; +SET AUTOCOMMIT=DEFAULT; + # Reset default environment. set GLOBAL query_cache_size=default; -- cgit v1.2.1 From b0bf53aa65135e6a4b0ebd581923745c3e812cbd Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 24 Mar 2010 18:39:23 +0400 Subject: Applying InnoDB snapshot, fixes BUG#47621. Detailed revision comments: r6783 | jyang | 2010-03-09 17:54:14 +0200 (Tue, 09 Mar 2010) | 9 lines branches/5.1: Fix bug #47621 "MySQL and InnoDB data dictionaries will become out of sync when renaming columns". MySQL does not provide new column name information to storage engine to update the system table. To avoid column name mismatch, we shall just request a table copy for now. rb://246 approved by Marko. --- mysql-test/t/innodb_bug47621.test | 57 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 mysql-test/t/innodb_bug47621.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb_bug47621.test b/mysql-test/t/innodb_bug47621.test new file mode 100644 index 00000000000..4863cc6bba1 --- /dev/null +++ b/mysql-test/t/innodb_bug47621.test @@ -0,0 +1,57 @@ +# This is the test for bug #47621, column rename operation should +# not result in column definition inconsistency between MySQL and +# InnoDB + +--source include/have_innodb.inc + +CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB; + +# Change the column name +ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT; + +# If there is inconsistency of column name definition +# in MySQL or InnoDB, following create index would fail +create index orgs on bug47621(sales_acct_id); + +# Change the column name back with the index defined on it. +ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT; + +drop table bug47621; + +CREATE TABLE bug47621_sale ( + salesperson INT, + PRIMARY KEY(salesperson)) engine = innodb; + +CREATE TABLE bug47621_shirt( + id SMALLINT, + owner INT, + FOREIGN KEY(owner) + references bug47621_sale(salesperson) ON DELETE RESTRICT) + engine = innodb; + +insert into bug47621_sale values(9); + +insert into bug47621_shirt values(1, 9); + +# Any rename operation on columns involved in a reference constraint will +# fail, as it will be rejected by InnoDB row_rename_table_for_mysql(). +# In above example, any rename on column "salesperson" for table +# "bug47621_sale", or on column "owner" for table "bug47621_shirt will +# be blocked. We do not put such rename in the test since InnoDB error +# message will be printed in the error log, and result in test failure. +# +# ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT; + +# Any rename on columns not involved in the foreign key constraint +# could still proceed +ALTER TABLE bug47621_shirt CHANGE id new_id INT; + +# Referencing table dropped, the rename operation on related columns +# could proceed +drop table bug47621_shirt; + +ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT; + +ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id); + +drop table bug47621_sale; -- cgit v1.2.1 From fbfbdc211eb976fdb5b3a7ca571b245c4a7a7c91 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 24 Mar 2010 18:51:57 +0400 Subject: Applying InnoDB snapshot Detailed revision comments: r6785 | vasil | 2010-03-10 09:04:38 +0200 (Wed, 10 Mar 2010) | 11 lines branches/5.1: Add the missing --reap statements in innodb_bug38231.test. Probably MySQL enforced the presence of those recently and the test started failing like: main.innodb_bug38231 [ fail ] Test ended at 2010-03-10 08:48:32 CURRENT_TEST: main.innodb_bug38231 mysqltest: At line 49: Cannot run query on connection between send and reap r6788 | vasil | 2010-03-10 10:53:21 +0200 (Wed, 10 Mar 2010) | 8 lines branches/5.1: In innodb_bug38231.test: replace the fragile sleep 0.2 that depends on timing with a more robust condition which waits for the TRUNCATE and LOCK commands to appear in information_schema.processlist. This could also break if there are other sessions executing the same SQL commands, but there are none during the execution of the mysql test. --- mysql-test/t/innodb_bug38231.test | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb_bug38231.test b/mysql-test/t/innodb_bug38231.test index b3fcd89f371..54f58844c42 100644 --- a/mysql-test/t/innodb_bug38231.test +++ b/mysql-test/t/innodb_bug38231.test @@ -16,6 +16,7 @@ CREATE TABLE bug38231 (a INT); -- connect (con1,localhost,root,,) -- connect (con2,localhost,root,,) +-- connect (con3,localhost,root,,) -- connection con1 SET autocommit=0; @@ -26,15 +27,30 @@ SET autocommit=0; -- send LOCK TABLE bug38231 WRITE; +-- connection con3 +SET autocommit=0; +-- send +LOCK TABLE bug38231 WRITE; + -- connection default -- send TRUNCATE TABLE bug38231; -- connection con1 -# give time to TRUNCATE and others to be executed; without sleep, sometimes -# UNLOCK executes before TRUNCATE -# TODO: Replace with wait_condition once possible under embedded server. --- sleep 0.2 +# Wait for TRUNCATE and the other two LOCKs to be executed; without this, +# sometimes UNLOCK executes before them. We assume there are no other +# sessions executing at the same time with the same SQL commands. +let $wait_condition = + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE info = 'TRUNCATE TABLE bug38231'; +-- source include/wait_condition.inc +let $wait_condition = + SELECT COUNT(*) = 2 FROM information_schema.processlist + WHERE info = 'LOCK TABLE bug38231 WRITE'; +-- source include/wait_condition.inc +# the above enables query log, re-disable it +-- disable_query_log + # this crashes the server if the bug is present UNLOCK TABLES; @@ -44,10 +60,16 @@ UNLOCK TABLES; -- reap UNLOCK TABLES; +-- connection con3 +-- reap +UNLOCK TABLES; + -- connection default -- reap + -- disconnect con1 -- disconnect con2 +-- disconnect con3 # test that TRUNCATE works with with row-level locks -- cgit v1.2.1 From b57ef6d3cdbb9235cafb7f7081a592c2ceebd1bd Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 25 Mar 2010 15:49:01 +0400 Subject: BUG#51877 - HANDLER interface causes invalid memory read Invalid memory read if HANDLER ... READ NEXT is executed after failed (e.g. empty table) HANDLER ... READ FIRST. The problem was that we attempted to perform READ NEXT, whereas there is no pivot available from failed READ FIRST. With this fix READ NEXT after failed READ FIRST equals to READ FIRST. This bug affects MyISAM tables only. mysql-test/r/gis-rtree.result: Restore a test case for BUG51357. mysql-test/r/handler_myisam.result: A test case for BUG#51877. mysql-test/t/gis-rtree.test: Restore a test case for BUG51357. mysql-test/t/handler_myisam.test: A test case for BUG#51877. storage/myisam/mi_rnext.c: "search first" failed. This means we have no pivot for "search next", or in other words MI_INFO::lastkey is likely uninitialized. Normally SQL layer would never request "search next" if "search first" failed. But HANDLER may do anything. As mi_rnext() without preceeding mi_rkey()/mi_rfirst() equals to mi_rfirst(), we must restore original state as if failing mi_rfirst() was not called. --- mysql-test/t/gis-rtree.test | 15 ++++++++------- mysql-test/t/handler_myisam.test | 11 +++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test index c5d5bfee861..b006096528e 100644 --- a/mysql-test/t/gis-rtree.test +++ b/mysql-test/t/gis-rtree.test @@ -914,14 +914,15 @@ HANDLER t1 READ a PREV; HANDLER t1 READ a LAST; HANDLER t1 CLOSE; -#TODO: re-enable this test please when bug #51877 is solved # second crash fixed when the tree has changed since the last search. -#HANDLER t1 OPEN; -#HANDLER t1 READ a FIRST; -#INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); -#HANDLER t1 READ a NEXT; -#HANDLER t1 CLOSE; -#TODO: end of the 51877 dependent section +HANDLER t1 OPEN; +HANDLER t1 READ a FIRST; +INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); +--echo # should not crash +--disable_result_log +HANDLER t1 READ a NEXT; +--enable_result_log +HANDLER t1 CLOSE; DROP TABLE t1; diff --git a/mysql-test/t/handler_myisam.test b/mysql-test/t/handler_myisam.test index da02a90af0f..868ba14480a 100644 --- a/mysql-test/t/handler_myisam.test +++ b/mysql-test/t/handler_myisam.test @@ -37,4 +37,15 @@ TRUNCATE t1; HANDLER t1 READ FIRST; DROP TABLE t1; +--echo # +--echo # BUG#51877 - HANDLER interface causes invalid memory read +--echo # +CREATE TABLE t1(a INT, KEY(a)); +HANDLER t1 OPEN; +HANDLER t1 READ a FIRST; +INSERT INTO t1 VALUES(1); +HANDLER t1 READ a NEXT; +HANDLER t1 CLOSE; +DROP TABLE t1; + --echo End of 5.1 tests -- cgit v1.2.1 From 412798658a5ede71651ed9112791d055a42edef7 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 25 Mar 2010 16:08:21 +0400 Subject: BUG#51866 - crash with repair by sort and fulltext keys Repairing MyISAM table with fulltext indexes and low myisam_sort_buffer_size may crash the server. Estimation of number of index entries was done incorrectly, causing further assertion failure or server crash. Docs note: min value for myisam_sort_buffer_size has been changed from 4 to 4096. mysql-test/r/fulltext.result: A test case for BUG#51866. mysql-test/r/myisam.result: Min value for myisam_sort_buffer_size is 4096. mysql-test/r/variables.result: Min value for myisam_sort_buffer_size is 4096. mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_32.result: Min value for myisam_sort_buffer_size is 4096. mysql-test/t/fulltext.test: A test case for BUG#51866. sql/mysqld.cc: Min value for myisam_sort_buffer_size is 4096. storage/myisam/mi_check.c: When estimating number of index entries for external fulltext parser, take into account that key_length may be bigger than myisam_sort_buffer_size. Reuse logic from _create_index_by_sort(): force MIN_SORT_BUFFER to be min value for myisam_sort_buffer_size. Another problem is that ftkey_nr has no other meaning than serial number of fulltext index starting with 1. We can't say if this key using built-in or external parser basing on it's value. In other words we always entered if-branch for external parser. At this point, the only way to check if we use default parser is to compare keyinfo::parser with &ft_default_parser. storage/myisam/sort.c: Get rid of MIN_SORT_MEMORY, use MIN_SORT_BUFFER instead (defined in myisamdef.h, has the same value and purpose). --- mysql-test/t/fulltext.test | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index afaabb781b8..ec64728a8c9 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -575,5 +575,14 @@ CREATE TABLE t1(a CHAR(1),FULLTEXT(a)); SELECT 1 FROM t1 WHERE MATCH(a) AGAINST ('') AND ROW(a,a) > ROW(1,1); DROP TABLE t1; +--echo # +--echo # BUG#51866 - crash with repair by sort and fulltext keys +--echo # +CREATE TABLE t1(a CHAR(4), FULLTEXT(a)); +INSERT INTO t1 VALUES('aaaa'); +SET myisam_sort_buffer_size=4; +REPAIR TABLE t1; +SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; +DROP TABLE t1; --echo End of 5.1 tests -- cgit v1.2.1 From 298c067eeede9e086252390856c990633fe08231 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 25 Mar 2010 23:57:06 +0400 Subject: BUG#46565 - repair of partition fail for archive engine There was no way to repair corrupt ARCHIVE data file, when unrecoverable data loss is inevitable. With this fix REPAIR ... EXTENDED attempts to restore as much rows as possible, ignoring unrecoverable data. Normal REPAIR is still able to repair meta-data file only. mysql-test/r/archive.result: A test case for BUG#46565. mysql-test/std_data/bug46565.ARZ: A test case for BUG#46565. mysql-test/std_data/bug46565.frm: A test case for BUG#46565. mysql-test/t/archive.test: A test case for BUG#46565. storage/archive/ha_archive.cc: Allow unrecoverable data loss when extended repair is requested. --- mysql-test/t/archive.test | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index 67ad0517ed2..7084f5f540e 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1655,3 +1655,26 @@ FLUSH TABLE t1; SELECT * FROM t1; --error ER_BAD_TABLE_ERROR DROP TABLE t1; + + +--echo # +--echo # BUG#46565 - repair of partition fail for archive engine +--echo # +--echo # Installing corrupted table files for t1. +# bug46565 was created, filled and damaged as following: +# CREATE TABLE bug46565(a INT) ENGINE=archive; +# INSERT INTO bug46565 VALUES(1); +# FLUSH TABLE bug46565; +# INSERT INTO bug46565 VALUES(2),(3); +# FLUSH TABLE bug46565; +# dd if=bug46565.ARZ of=std_data/bug46565.ARZ bs=1 count=8670 +copy_file std_data/bug46565.frm $MYSQLD_DATADIR/test/t1.frm; +copy_file std_data/bug46565.ARZ $MYSQLD_DATADIR/test/t1.ARZ; +--error ER_CRASHED_ON_USAGE +SELECT * FROM t1; +REPAIR TABLE t1; +--error ER_CRASHED_ON_USAGE +SELECT * FROM t1; +REPAIR TABLE t1 EXTENDED; +SELECT * FROM t1; +DROP TABLE t1; -- cgit v1.2.1 From d5325c7793a640d0f32d62088f84d3d19166add7 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 26 Mar 2010 09:49:35 +0400 Subject: Bug#52164 Assertion failed: param.sort_length, file .\filesort.cc, line 149 The crash happens because of incorrect max_length calculation in QUOTE function(due to overflow). max_length is set to 0 and it leads to assert failure. The fix is to cast expression result to ulonglong variable and adjust it if the result exceeds MAX_BLOB_WIDTH. mysql-test/r/func_str.result: test case mysql-test/t/func_str.test: test case sql/item_strfunc.h: cast expression result to ulonglong variable and adjust it if the result exceeds MAX_BLOB_WIDTH. --- mysql-test/t/func_str.test | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 8942b0a2faf..3392a41519b 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1352,3 +1352,14 @@ SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP FROM t2 WHERE t2.b = 1 GROUP BY t2.b; DROP TABLE t1, t2; + +--echo # +--echo # Bug#52164 Assertion failed: param.sort_length, file .\filesort.cc, line 149 +--echo # +CREATE TABLE t1 (a LONGBLOB NOT NULL); +INSERT INTO t1 VALUES (''),(''); +SELECT 1 FROM t1, t1 t2 +ORDER BY QUOTE(t1.a); +DROP TABLE t1; + +--echo End of 5.1 tests -- cgit v1.2.1 From f57839cd6060ff2d8edb4bf0875b67d0176d88e4 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 26 Mar 2010 11:44:24 +0400 Subject: Bug#52177 crash with explain, row comparison, join, text field The crash is the result of an attempt made by JOIN::optimize to evaluate the WHERE condition when no records have been actually read. The fix is to remove erroneous 'outer_join' variable check. mysql-test/r/join.result: test result mysql-test/t/join.test: test case sql/sql_select.cc: removed erroneous 'outer_join' variable check. --- mysql-test/t/join.test | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index ba61da289bc..a9900c34f1e 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -725,4 +725,15 @@ SELECT 1 FROM v1 right join v1 AS v2 ON RAND(); DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # Bug#52177 crash with explain, row comparison, join, text field +--echo # +CREATE TABLE t1 (a TINYINT, b TEXT, KEY (a)); +INSERT INTO t1 VALUES (0,''),(0,''); +FLUSH TABLES; +EXPLAIN SELECT 1 FROM t1 LEFT JOIN t1 a ON 1 +WHERE ROW(t1.a, 1111.11) = ROW(1111.11, 1111.11) AND +ROW(t1.b, 1111.11) <=> ROW('',''); +DROP TABLE t1; + --echo End of 5.0 tests. -- cgit v1.2.1 From 604ab4d274ab036acd1725707b436836e98699a0 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 26 Mar 2010 15:20:11 +0400 Subject: Applying InnoDB snapshot Detailed revision comments: r6884 | vdimov | 2010-03-26 13:05:03 +0200 (Fri, 26 Mar 2010) | 6 lines branches/5.1: Fix a non-determinism in innodb_bug38231. Reported by: Sergey Vojtovich r6884 | vdimov | 2010-03-26 13:05:03 +0200 (Fri, 26 Mar 2010) | 6 lines branches/5.1: Fix a non-determinism in innodb_bug38231. Reported by: Sergey Vojtovich --- mysql-test/t/innodb_bug38231.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb_bug38231.test b/mysql-test/t/innodb_bug38231.test index 54f58844c42..1611cb56203 100644 --- a/mysql-test/t/innodb_bug38231.test +++ b/mysql-test/t/innodb_bug38231.test @@ -27,6 +27,21 @@ SET autocommit=0; -- send LOCK TABLE bug38231 WRITE; +# When con1 does UNLOCK below this will release either con2 or con3 which are +# both waiting on LOCK. At the end we must first --reap and UNLOCK the +# connection that has been released, otherwise it will wait forever. We assume +# that the released connection will be the first one that has gained the LOCK, +# thus we force the order here - con2 does LOCK first, then con3. In other +# words we wait for LOCK from con2 above to be exected before doing LOCK in +# con3. +-- connection con1 +let $wait_condition = + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE info = 'LOCK TABLE bug38231 WRITE'; +-- source include/wait_condition.inc +# the above enables query log, re-disable it +-- disable_query_log + -- connection con3 SET autocommit=0; -- send -- cgit v1.2.1 From 454c003a5c5a31a8d59ba4ab54d3b3a90a609752 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 28 Mar 2010 19:57:33 +0800 Subject: Bug #50407 mysqlbinlog --database=X produces bad output for SAVEPOINTs When mysqlbinlog was given the --database=X flag, it always printed 'ROLLBACK TO', but the corresponding 'SAVEPOINT' statement was not printed. The replicated filter(replicated-do/ignore-db) and binlog filter (binlog-do/ignore-db) has the same problem. They are solved in this patch together. After this patch, We always check whether the query is 'SAVEPOINT' statement or not. Because this is a literal check, 'SAVEPOINT' and 'ROLLBACK TO' statements are also binlogged in uppercase with no any comments. The binlog before this patch can be handled correctly except one case that any comments are in front of the keywords. for example: /* bla bla */ SAVEPOINT a; /* bla bla */ ROLLBACK TO a; --- mysql-test/t/mysqlbinlog.test | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 0d3f0a8a7c4..7c9fbf031bb 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -434,12 +434,19 @@ FLUSH LOGS; # Transaction3 end --echo # ---echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is exist +--echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified exists --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 +--echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified does not exist --exec $MYSQL_BINLOG --database=not_exist --short-form $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001 +--echo # +--echo # Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified exists +--exec $MYSQL_BINLOG --database=db1 --short-form $MYSQLTEST_VARDIR/std_data/binlog_savepoint.000001 +--echo # +--echo # Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified does not exist +--exec $MYSQL_BINLOG --database=not_exist --short-form $MYSQLTEST_VARDIR/std_data/binlog_savepoint.000001 + --echo End of 5.0 tests --echo End of 5.1 tests -- cgit v1.2.1 From 1fec5af772809d4d67ebc3c84286bc4956b80773 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Sun, 28 Mar 2010 21:10:00 +0300 Subject: Fixed compiler warnings and sporadic failures in test cases mysql-test/extra/rpl_tests/rpl_tmp_table_and_DDL.test: Added missing sync_slave_with_master; Fixes random failures mysql-test/include/default_mysqld.cnf: default-character-set -> character-set-server (removes warning in error files for usage of deprecated options) mysql-test/lib/My/SafeProcess/safe_process.cc: Fixed compiler warning mysql-test/lib/v1/mysql-test-run.pl: default-character-set -> character-set-server (removes warning in error files for usage of deprecated options) mysql-test/suite/rpl/r/rpl_do_grant.result: Updated test results mysql-test/suite/rpl/t/rpl_do_grant.test: Added missing sync_slave_with_master; Fixes random failures Had to explictely do stop slave before DROP USER to avoid failure on slave as the user is already dropped on slave. mysql-test/suite/rpl/t/rpl_name_const.test: Added missing sync_slave_with_master; Fixes random failures mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test: Added missing sync_slave_with_master; Fixes random failures mysql-test/t/bug47671-master.opt: default-character-set -> character-set-server (removes warning in error files for usage of deprecated options) mysql-test/t/ctype_latin1_de-master.opt: default-character-set -> character-set-server (removes warning in error files for usage of deprecated options) mysql-test/t/ctype_ucs2_def-master.opt: default-character-set -> character-set-server (removes warning in error files for usage of deprecated options) sql-common/client.c: Fixed compiler warning sql/item.cc: Renamed function to remove compiler warnings (with gcc) sql/item.h: Renamed function to remove compiler warnings (with gcc) sql/item_cmpfunc.cc: Renamed function to remove compiler warnings (with gcc) sql/item_create.cc: Renamed function to remove compiler warnings (with gcc) sql/item_create.h: Renamed function to remove compiler warnings (with gcc) sql/item_sum.cc: Renamed function to remove compiler warnings (with gcc) sql/item_sum.h: Renamed function to remove compiler warnings (with gcc) sql/set_var.cc: Don't use bit_do_set() / bot_is_set() / bit_do_clear() as this generates compiler warnings (They are also of no use as we know the value can hold the bits) sql/sql_yacc.yy: Renamed function to remove compiler warnings (with gcc) storage/example/ha_example.h: Fixed old read_time() prototype storage/maria/ma_search.c: Added extra variables to remove compiler warnings storage/maria/maria_def.h: Added extra variables to remove compiler warnings storage/myisam/ft_stopwords.c: Added cast to get rid of compiler warning storage/xtradb/fil/fil0fil.c: Added cast to get rid of compiler warning storage/xtradb/include/page0page.h: Added const to get rid of compiler warning storage/xtradb/include/page0page.ic: Added const to get rid of compiler warning support-files/compiler_warnings.supp: Added suppression of strict-aliasing --- mysql-test/t/bug47671-master.opt | 2 +- mysql-test/t/ctype_latin1_de-master.opt | 2 +- mysql-test/t/ctype_ucs2_def-master.opt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/bug47671-master.opt b/mysql-test/t/bug47671-master.opt index 0afdf49e022..ad54fbc3467 100644 --- a/mysql-test/t/bug47671-master.opt +++ b/mysql-test/t/bug47671-master.opt @@ -1 +1 @@ ---default-character-set=utf8 --skip-character-set-client-handshake +--character-set-server=utf8 --skip-character-set-client-handshake diff --git a/mysql-test/t/ctype_latin1_de-master.opt b/mysql-test/t/ctype_latin1_de-master.opt index 79fdb1c63dc..063fe5b7792 100644 --- a/mysql-test/t/ctype_latin1_de-master.opt +++ b/mysql-test/t/ctype_latin1_de-master.opt @@ -1 +1 @@ ---default-character-set=latin1 --default-collation=latin1_german2_ci +--character-set-server=latin1 --default-collation=latin1_german2_ci diff --git a/mysql-test/t/ctype_ucs2_def-master.opt b/mysql-test/t/ctype_ucs2_def-master.opt index 84d2a52b639..d42c50f3c7e 100644 --- a/mysql-test/t/ctype_ucs2_def-master.opt +++ b/mysql-test/t/ctype_ucs2_def-master.opt @@ -1 +1 @@ ---default-collation=ucs2_unicode_ci --default-character-set=ucs2,latin1 +--default-collation=ucs2_unicode_ci --character-set-server=ucs2,latin1 -- cgit v1.2.1 From 291fd9698340f3d83ff096542720f7335cb078d2 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 29 Mar 2010 17:13:53 +0200 Subject: pluggable auth with plugin examples Makefile.am: add new API files to the check_abi rule, remove duplicates client/CMakeLists.txt: now a client can use dlopen too client/Makefile.am: be csh-friendly include/my_global.h: add dummy plugs for dlopen and co. for the code that needs them to work in static builds mysys/Makefile.am: be csh-friendly plugin/auth/dialog.c: typo fixed --- mysql-test/t/change_user.test | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/change_user.test b/mysql-test/t/change_user.test index 46bf1d2a92c..b529ab7539b 100644 --- a/mysql-test/t/change_user.test +++ b/mysql-test/t/change_user.test @@ -1,3 +1,49 @@ +# +# functional change user tests +# + +grant select on test.* to test_nopw; +grant select on test.* to test_oldpw identified by password "09301740536db389"; +grant select on test.* to test_newpw identified by "newpw"; + +# +# massaging the data for tests to pass in the embedded server, +# that has authentication completely disabled. +# + +--replace_result <@> @> @localhost> +select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); + +change_user test_nopw; +--replace_result <@> @> @localhost> +select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); +change_user test_oldpw, oldpw; +--replace_result <@> @> @localhost> +select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); +change_user test_newpw, newpw; +--replace_result <@> @> @localhost> +select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); +change_user root; +--replace_result <@> @> @localhost> +select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); + +change_user test_nopw,,test; +--replace_result <@> @> @localhost> +select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); +change_user test_oldpw,oldpw,test; +--replace_result <@> @> @localhost> +select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); +change_user test_newpw,newpw,test; +--replace_result <@> @> @localhost> +select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); +change_user root,,test; +--replace_result <@> @> @localhost> +select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); + +drop user test_nopw; +drop user test_oldpw; +drop user test_newpw; + # # Bug#20023 mysql_change_user() resets the value of SQL_BIG_SELECTS # The replace's are here to fix things for 32 bit systems -- cgit v1.2.1 From 89989ffb168e1bc35cb2f50ff18530a0f63b38be Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 30 Mar 2010 15:03:50 +0300 Subject: Bug #51893: crash with certain characters given to load_file function on windows When making sure that the directory path ends up with a slash/backslash we need to check for the correct length of the buffer and trim at the appropriate location so we don't write past the end of the buffer. --- mysql-test/t/loaddata.test | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index cd22b700430..d86c395e436 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -497,5 +497,12 @@ set session sql_mode=@OLD_SQL_MODE; DROP TABLE t1,t2; +--echo # +--echo # Bug #51893: crash with certain characters given to load_file +--echo # function on windows +--echo # + +select load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A); + --echo End of 5.0 tests -- cgit v1.2.1 From 55852670ccc6f8173fef7b26b544213ac0829dc0 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Wed, 31 Mar 2010 17:00:56 +0400 Subject: Fix for bug#52397: another crash with explain extended and group_concat Problem: EXPLAIN EXTENDED was trying to resolve references to freed temporary table fields for GROUP_CONCAT()'s ORDER BY arguments. Fix: use stored original GROUP_CONCAT()'s arguments in such a case. mysql-test/r/func_gconcat.result: Fix for bug#52397: another crash with explain extended and group_concat - test result. mysql-test/t/func_gconcat.test: Fix for bug#52397: another crash with explain extended and group_concat - test case. sql/item_sum.cc: Fix for bug#52397: another crash with explain extended and group_concat - use "pargs", printing ORDER BY arguments in the Item_func_group_concat::print() instead of "order" to avoid possible reference resolving to (freed) temporary table fields. --- mysql-test/t/func_gconcat.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index cfb4cdc9ecd..e832ea316eb 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -708,4 +708,16 @@ SELECT 1 FROM DROP TABLE t1; + +--echo # +--echo # Bug #52397: another crash with explain extended and group_concat +--echo # +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0), (0); +EXPLAIN EXTENDED SELECT 1 FROM + (SELECT GROUP_CONCAT(t1.a ORDER BY t1.a ASC) FROM + t1 t2, t1 GROUP BY t1.a) AS d; +DROP TABLE t1; + + --echo End of 5.0 tests -- cgit v1.2.1 From 3f78f016e7c010996e6a3dabdb190ea2f5f2e113 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Wed, 31 Mar 2010 16:04:40 +0300 Subject: Move ./storage/innobase/mysql-test/* into ./mysql-test/* except innodb.*, innodb_bug34300* and innodb_bug39438* in order to preserve their history from SVN. --- mysql-test/t/innodb_bug38231.test | 45 ++++++++++++++++++++++++++++--- mysql-test/t/innodb_bug47621.test | 57 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 mysql-test/t/innodb_bug47621.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb_bug38231.test b/mysql-test/t/innodb_bug38231.test index b3fcd89f371..1611cb56203 100644 --- a/mysql-test/t/innodb_bug38231.test +++ b/mysql-test/t/innodb_bug38231.test @@ -16,6 +16,7 @@ CREATE TABLE bug38231 (a INT); -- connect (con1,localhost,root,,) -- connect (con2,localhost,root,,) +-- connect (con3,localhost,root,,) -- connection con1 SET autocommit=0; @@ -26,15 +27,45 @@ SET autocommit=0; -- send LOCK TABLE bug38231 WRITE; +# When con1 does UNLOCK below this will release either con2 or con3 which are +# both waiting on LOCK. At the end we must first --reap and UNLOCK the +# connection that has been released, otherwise it will wait forever. We assume +# that the released connection will be the first one that has gained the LOCK, +# thus we force the order here - con2 does LOCK first, then con3. In other +# words we wait for LOCK from con2 above to be exected before doing LOCK in +# con3. +-- connection con1 +let $wait_condition = + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE info = 'LOCK TABLE bug38231 WRITE'; +-- source include/wait_condition.inc +# the above enables query log, re-disable it +-- disable_query_log + +-- connection con3 +SET autocommit=0; +-- send +LOCK TABLE bug38231 WRITE; + -- connection default -- send TRUNCATE TABLE bug38231; -- connection con1 -# give time to TRUNCATE and others to be executed; without sleep, sometimes -# UNLOCK executes before TRUNCATE -# TODO: Replace with wait_condition once possible under embedded server. --- sleep 0.2 +# Wait for TRUNCATE and the other two LOCKs to be executed; without this, +# sometimes UNLOCK executes before them. We assume there are no other +# sessions executing at the same time with the same SQL commands. +let $wait_condition = + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE info = 'TRUNCATE TABLE bug38231'; +-- source include/wait_condition.inc +let $wait_condition = + SELECT COUNT(*) = 2 FROM information_schema.processlist + WHERE info = 'LOCK TABLE bug38231 WRITE'; +-- source include/wait_condition.inc +# the above enables query log, re-disable it +-- disable_query_log + # this crashes the server if the bug is present UNLOCK TABLES; @@ -44,10 +75,16 @@ UNLOCK TABLES; -- reap UNLOCK TABLES; +-- connection con3 +-- reap +UNLOCK TABLES; + -- connection default -- reap + -- disconnect con1 -- disconnect con2 +-- disconnect con3 # test that TRUNCATE works with with row-level locks diff --git a/mysql-test/t/innodb_bug47621.test b/mysql-test/t/innodb_bug47621.test new file mode 100644 index 00000000000..4863cc6bba1 --- /dev/null +++ b/mysql-test/t/innodb_bug47621.test @@ -0,0 +1,57 @@ +# This is the test for bug #47621, column rename operation should +# not result in column definition inconsistency between MySQL and +# InnoDB + +--source include/have_innodb.inc + +CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB; + +# Change the column name +ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT; + +# If there is inconsistency of column name definition +# in MySQL or InnoDB, following create index would fail +create index orgs on bug47621(sales_acct_id); + +# Change the column name back with the index defined on it. +ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT; + +drop table bug47621; + +CREATE TABLE bug47621_sale ( + salesperson INT, + PRIMARY KEY(salesperson)) engine = innodb; + +CREATE TABLE bug47621_shirt( + id SMALLINT, + owner INT, + FOREIGN KEY(owner) + references bug47621_sale(salesperson) ON DELETE RESTRICT) + engine = innodb; + +insert into bug47621_sale values(9); + +insert into bug47621_shirt values(1, 9); + +# Any rename operation on columns involved in a reference constraint will +# fail, as it will be rejected by InnoDB row_rename_table_for_mysql(). +# In above example, any rename on column "salesperson" for table +# "bug47621_sale", or on column "owner" for table "bug47621_shirt will +# be blocked. We do not put such rename in the test since InnoDB error +# message will be printed in the error log, and result in test failure. +# +# ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT; + +# Any rename on columns not involved in the foreign key constraint +# could still proceed +ALTER TABLE bug47621_shirt CHANGE id new_id INT; + +# Referencing table dropped, the rename operation on related columns +# could proceed +drop table bug47621_shirt; + +ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT; + +ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id); + +drop table bug47621_sale; -- cgit v1.2.1 From 292add1cf8efc3ed7580590cfa8c9c2a71bf8e19 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Wed, 31 Mar 2010 16:07:55 +0300 Subject: Rename the newly added mysql-tests from InnoDB to their proper location. --- mysql-test/t/innodb_bug51920.test | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 mysql-test/t/innodb_bug51920.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb_bug51920.test b/mysql-test/t/innodb_bug51920.test new file mode 100644 index 00000000000..4f22d7f0d06 --- /dev/null +++ b/mysql-test/t/innodb_bug51920.test @@ -0,0 +1,33 @@ +# +# Bug #51920: InnoDB connections in lock wait ignore KILL until timeout +# +-- source include/not_embedded.inc +-- source include/have_innodb.inc + +CREATE TABLE bug51920 (i INT) ENGINE=InnoDB; +INSERT INTO bug51920 VALUES (1); + +BEGIN; +SELECT * FROM bug51920 FOR UPDATE; + +connect (con1,localhost,root,,); + +connection con1; +--send +UPDATE bug51920 SET i=2; + +connection default; +SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST +WHERE INFO="UPDATE bug51920 SET i=2" +INTO @thread_id; + +KILL @thread_id; +SELECT sleep(2); +SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID=@thread_id; + +connection con1; +-- error ER_QUERY_INTERRUPTED +reap; +connection default; +DROP TABLE bug51920; +-- disconnect con1 -- cgit v1.2.1 From e65caec1387ecc3b25a3a97c5ccedb9c16caa0ef Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 31 Mar 2010 16:12:37 +0300 Subject: Bug #37168: Missing variable - skip_name_resolve Added a read-only global boolean variable skip_name_resolve. --- mysql-test/t/skip_name_resolve.test | 21 +++++++++++++++++++++ mysql-test/t/variables.test | 8 ++++++++ 2 files changed, 29 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/skip_name_resolve.test b/mysql-test/t/skip_name_resolve.test index df010d15fa0..0edbdbcd22c 100644 --- a/mysql-test/t/skip_name_resolve.test +++ b/mysql-test/t/skip_name_resolve.test @@ -29,3 +29,24 @@ disconnect con1; # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc +--echo # +--echo # Bug #37168: Missing variable - skip_name_resolve +--echo # + +SHOW VARIABLES LIKE 'skip_name_resolve'; +SHOW GLOBAL VARIABLES LIKE 'skip_name_resolve'; +SHOW SESSION VARIABLES LIKE 'skip_name_resolve'; + +SELECT @@skip_name_resolve; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@LOCAL.skip_name_resolve; +SELECT @@GLOBAL.skip_name_resolve; + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@skip_name_resolve=0; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@LOCAL.skip_name_resolve=0; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.skip_name_resolve=0; + +--echo End of 5.1 tests diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 6c9015a1bff..7b3ea599b9e 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -1232,4 +1232,12 @@ SET @old_max_binlog_cache_size = @@GLOBAL.max_binlog_cache_size; SET GLOBAL max_binlog_cache_size = 5 * 1024 * 1024 * 1024; SELECT @@GLOBAL.max_binlog_cache_size; SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size; + +--echo # +--echo # Bug #37168 : Missing variable - skip_name_resolve +--echo # + +SELECT @@skip_name_resolve; +SHOW VARIABLES LIKE 'skip_name_resolve'; + --echo End of 5.1 tests -- cgit v1.2.1 From 0513c2461ce6d341ef744cd5621648bc67f749e6 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Wed, 31 Mar 2010 11:45:41 -0700 Subject: Adjusted results --- mysql-test/t/key_cache.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index f0222353b15..5476e155938 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -316,12 +316,12 @@ update t2 set i=2 where i=1; --replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED show status like 'key_%'; ---replace_column 7 # +--replace_column 6 # 7 # select * from information_schema.key_caches; delete from t1; delete from t2; ---replace_column 7 # +--replace_column 6 # 7 # select * from information_schema.key_caches; # Check that we can work with one partition with the same results -- cgit v1.2.1 From ecba0ec8ed5c165966b29ed3f84158dd7b1bd544 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Wed, 31 Mar 2010 16:37:28 -0700 Subject: Made the results of the key_cache test to be platform independent. --- mysql-test/t/key_cache.test | 77 ++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 36 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index 5476e155938..c7b3a318c76 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -272,7 +272,7 @@ create table t2 ( select @@key_cache_partitions; --replace_column 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; insert into t1 values (1, 'qqqq'), (2, 'yyyy'); insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), @@ -285,16 +285,16 @@ update t2 set i=2 where i=1; --replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED show status like 'key_%'; --replace_column 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; delete from t2 where a='zzzz'; --replace_column 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; delete from t1; delete from t2; --replace_column 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; # For the key cache with 2 partitions execute the same sequence of # statements as for the simple cache above. @@ -304,7 +304,7 @@ select * from information_schema.key_caches; set global key_cache_partitions=2; select @@key_cache_partitions; --replace_column 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; insert into t1 values (1, 'qqqq'), (2, 'yyyy'); insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), @@ -316,20 +316,20 @@ update t2 set i=2 where i=1; --replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED show status like 'key_%'; ---replace_column 6 # 7 # -select * from information_schema.key_caches; +--replace_column 7 # +select * from information_schema.key_caches where partition_number is null; delete from t1; delete from t2; ---replace_column 6 # 7 # -select * from information_schema.key_caches; +--replace_column 7 # +select * from information_schema.key_caches where partition_number is null; # Check that we can work with one partition with the same results set global key_cache_partitions=1; select @@key_cache_partitions; --replace_column 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; insert into t1 values (1, 'qqqq'), (2, 'yyyy'); insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), @@ -342,16 +342,16 @@ update t2 set i=2 where i=1; --replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED show status like 'key_%'; --replace_column 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; delete from t1; delete from t2; --replace_column 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; flush tables; flush status; --replace_column 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; # Switch back to 2 partitions @@ -360,7 +360,7 @@ select @@key_buffer_size; set global key_cache_partitions=2; select @@key_cache_partitions; --replace_column 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; insert into t1 values (1, 'qqqq'), (2, 'yyyy'); insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), @@ -371,7 +371,7 @@ update t1 set p=3 where p=1; update t2 set i=2 where i=1; --replace_column 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; # Add more rows to tables t1 and t2 @@ -394,18 +394,18 @@ insert into t2(i,a) select i,a from t2; insert into t2(i,a) select i,a from t2; --replace_column 6 # 7 # 10 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; select * from t1 where p between 1010 and 1020 ; select * from t2 where p between 1010 and 1020 ; --replace_column 6 # 7 # 10 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; flush tables; flush status; update t1 set a='zzzz' where a='qqqq'; update t2 set i=1 where i=2; --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; # Now test how we can work with 7 partitions @@ -415,9 +415,10 @@ set global keycache1.key_cache_partitions=7; select @@keycache1.key_cache_partitions; --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; --replace_column 7 # -select * from information_schema.key_caches where key_cache_name like "key%"; +select * from information_schema.key_caches where key_cache_name like "key%" + and partition_number is null; cache index t1 key (`primary`) in keycache1; @@ -429,22 +430,26 @@ explain select count(*) from t1, t2 where t1.p = t2.i; select count(*) from t1, t2 where t1.p = t2.i; --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; --replace_column 7 # -select * from information_schema.key_caches where key_cache_name like "key%"; +select * from information_schema.key_caches where key_cache_name like "key%" + and partition_number is null; cache index t2 in keycache1; update t2 set p=p+3000, i=2 where a='qqqq'; --replace_column 7 # -select * from information_schema.key_caches where key_cache_name like "key%"; +select * from information_schema.key_caches where key_cache_name like "key%" + and partition_number is null; set global keycache2.key_buffer_size=1024*1024; cache index t2 in keycache2; insert into t2 values (2000, 3, 'yyyy'); --replace_column 7 # -select * from information_schema.key_caches where key_cache_name like "keycache2"; +select * from information_schema.key_caches where key_cache_name like "keycache2" + and partition_number is null; --replace_column 7 # -select * from information_schema.key_caches where key_cache_name like "key%"; +select * from information_schema.key_caches where key_cache_name like "key%" + and partition_number is null; cache index t2 in keycache1; update t2 set p=p+5000 where a='zzzz'; @@ -456,49 +461,49 @@ select i from t2 where a='yyyy' and i=3; explain select a from t2 where a='yyyy' and i=3; select a from t2 where a='yyyy' and i=3 ; --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; set global keycache1.key_cache_block_size=2*1024; insert into t2 values (7000, 3, 'yyyy'); --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; set global keycache1.key_cache_block_size=8*1024; insert into t2 values (8000, 3, 'yyyy'); --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; set global keycache1.key_buffer_size=64*1024; --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; set global keycache1.key_cache_block_size=2*1024; --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; set global keycache1.key_cache_block_size=8*1024; --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; set global keycache1.key_buffer_size=0; --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; set global keycache1.key_cache_block_size=8*1024; --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; set global keycache1.key_buffer_size=0; --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; set global keycache1.key_buffer_size=128*1024; --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; set global keycache1.key_cache_block_size=1024; --replace_column 6 # 7 # -select * from information_schema.key_caches; +select * from information_schema.key_caches where partition_number is null; drop table t1,t2; -- cgit v1.2.1 From ba229d799a0d3bd2499629bdd57212bcd7c98a38 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Tue, 6 Apr 2010 12:26:59 +0500 Subject: Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817 We should disable const subselect item evaluation because subselect transformation does not happen in view_prepare_mode and thus val_...() methods can not be called. mysql-test/r/ctype_ucs.result: test case mysql-test/r/view.result: test case mysql-test/t/ctype_ucs.test: test case mysql-test/t/view.test: test case sql/item.cc: disabled const subselect item evaluation in view prepare mode. sql/item_subselect.cc: added Item_subselect::safe_charset_converter which prevents const item evaluation in view prepare mode. sql/item_subselect.h: added Item_subselect::safe_charset_converter which prevents const item evaluation in view prepare mode. --- mysql-test/t/ctype_ucs.test | 9 +++++++++ mysql-test/t/view.test | 9 +++++++++ 2 files changed, 18 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 310576b9478..fd10ee3fdd6 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -732,4 +732,13 @@ SELECT HEX(MONTHNAME(19700101)); SELECT HEX(DAYNAME(19700101)); SET character_set_connection=latin1; +--echo # +--echo # Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817 +--echo # +CREATE TABLE t1 (a CHAR(1) CHARSET ascii, b CHAR(1) CHARSET latin1); +CREATE VIEW v1 AS SELECT 1 from t1 +WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); +DROP VIEW v1; +DROP TABLE t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 1d0796469f2..3736f53b288 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3916,6 +3916,15 @@ ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' ))); DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817 +--echo # +CREATE TABLE t1 (a CHAR(1) CHARSET latin1, b CHAR(1) CHARSET utf8); +CREATE VIEW v1 AS SELECT 1 from t1 +WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); +DROP VIEW v1; +DROP TABLE t1; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.1 tests. --echo # ----------------------------------------------------------------- -- cgit v1.2.1 From 16fadb10b5d2a9328b5caa85963a3d851b35cef4 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 16 Apr 2010 10:30:53 +0300 Subject: Bug #52629: memory leak from sys_var_thd_dbug in binlog.binlog_write_error When re-setting (SET GLOBAL debug='') the GLOBAL debug settings the server was not freeing the data elements from the top (initial) frame before setting them to 0 without freeing the underlying memory. As these are global settings there's a chance that something is there already. Fixed by : 1. making sure the allocated data are cleaned up before re-setting them while parsing a debug string 2. making sure the stuff allocated in the global settings is freed on shutdown. --- mysql-test/t/variables_debug.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/variables_debug.test b/mysql-test/t/variables_debug.test index 7dcaf246803..8f2bde7ae42 100644 --- a/mysql-test/t/variables_debug.test +++ b/mysql-test/t/variables_debug.test @@ -10,3 +10,16 @@ set debug= '+P'; select @@debug; set debug= '-P'; select @@debug; + +--echo # +--echo # Bug #52629: memory leak from sys_var_thd_dbug in +--echo # binlog.binlog_write_error +--echo # + +SET GLOBAL debug='d,injecting_fault_writing'; +SELECT @@global.debug; +SET GLOBAL debug=''; +SELECT @@global.debug; + + +--echo End of 5.1 tests -- cgit v1.2.1 From 649deaa8a1ab7660322152156b862a27de78d327 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 16 Apr 2010 16:42:34 +0500 Subject: Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings Arg_comparator initializes 'comparators' array in case of ROW comparison and does not free this array on destruction. It leads to memory leaks. The fix: -added Arg_comparator::cleanup() method which frees 'comparators' array. -added Item_bool_func2::cleanup() method which calls Arg_comparator::cleanup() method mysql-test/r/ps.result: test case mysql-test/r/row.result: test case mysql-test/t/ps.test: test case mysql-test/t/row.test: test case sql/item_cmpfunc.h: -added Arg_comparator::cleanup() method which frees 'comparators' array. -added Item_bool_func2::cleanup() method which calls Arg_comparator::cleanup() method --- mysql-test/t/ps.test | 14 ++++++++++++++ mysql-test/t/row.test | 11 +++++++++++ 2 files changed, 25 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index d5f7eda5032..4390b70e9e9 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3065,4 +3065,18 @@ select @plaintext; deallocate prepare encode; deallocate prepare decode; +--echo # +--echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings +--echo # +CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT); +INSERT INTO t1 VALUES (0, 0),(0, 0); +PREPARE stmt FROM "SELECT 1 FROM t1 WHERE +ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))"; +--disable_warnings +EXECUTE stmt; +EXECUTE stmt; +--enable_warnings +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + --echo End of 5.1 tests. diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index fcc4259168b..cec44078279 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -255,3 +255,14 @@ select * from t1,t2 where (a,b) = (c,d); select host,user from mysql.user where (host,user) = ('localhost','test'); drop table t1,t2; + +--echo # +--echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings +--echo # +CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT); +INSERT INTO t1 VALUES (0, 0),(0, 0); +--disable_warnings +SELECT 1 FROM t1 WHERE ROW(a, b) >= +ROW('1', (SELECT 1 FROM t1 WHERE a > 1234)); +--enable_warnings +DROP TABLE t1; -- cgit v1.2.1 From 20c9177518c3bb07c74df9fa8e25ba46af60f484 Mon Sep 17 00:00:00 2001 From: Staale Smedseng Date: Thu, 22 Apr 2010 15:52:00 +0200 Subject: Bug#46261 Plugins can be installed with --skip-grant-tables Previously installed dynamic plugins are explicitly not loaded on startup with --skip-grant-tables enabled. However, INSTALL PLUGIN/UNINSTALL PLUGIN commands are allowed, and result in inconsistent error messages (reporting duplicate plugin or plugin does not exist). This patch adds a check for --skip-grant-tables mode, and returns error ER_OPTION_PREVENTS_STATEMENT to the user when the above commands are attempted. --- mysql-test/t/bug46261-master.opt | 1 + mysql-test/t/bug46261.test | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 mysql-test/t/bug46261-master.opt create mode 100644 mysql-test/t/bug46261.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/bug46261-master.opt b/mysql-test/t/bug46261-master.opt new file mode 100644 index 00000000000..6be4269e809 --- /dev/null +++ b/mysql-test/t/bug46261-master.opt @@ -0,0 +1 @@ +--skip-grant-tables $EXAMPLE_PLUGIN_OPT diff --git a/mysql-test/t/bug46261.test b/mysql-test/t/bug46261.test new file mode 100644 index 00000000000..67bdc995850 --- /dev/null +++ b/mysql-test/t/bug46261.test @@ -0,0 +1,16 @@ +--source include/not_embedded.inc +--source include/have_example_plugin.inc + +--echo # +--echo # Bug#46261 Plugins can be installed with --skip-grant-tables +--echo # + +--replace_regex /\.dll/.so/ +--error ER_OPTION_PREVENTS_STATEMENT +eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO; + +--replace_regex /\.dll/.so/ +--error ER_OPTION_PREVENTS_STATEMENT +eval UNINSTALL PLUGIN example; + +--echo End of 5.1 tests -- cgit v1.2.1 From 6595861f5802dad8997fcaa6466d0ca1130d4df7 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Sun, 25 Apr 2010 15:06:40 +0400 Subject: Fix for bug#50946: fast index creation still seems to copy the table Problem: ALTER TABLE ADD INDEX may lead to table copying if there's numeric field(s) with non-default display width modificator specified. Fix: compare numeric field's storage lenghts when we decide whether they can be considered 'equal' for table alteration purposes. mysql-test/r/error_simulation.result: Fix for bug#50946: fast index creation still seems to copy the table - test result. mysql-test/t/error_simulation.test: Fix for bug#50946: fast index creation still seems to copy the table - test case. sql/field.cc: Fix for bug#50946: fast index creation still seems to copy the table - check numeric field's pack lengths instead of it's display lenghts comparing fields equality for table alteration purposes. sql/sql_table.cc: Fix for bug#50946: fast index creation still seems to copy the table - check compare_tables() result for testing purposes. --- mysql-test/t/error_simulation.test | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test index f730c95208e..7cd16a6bc5a 100644 --- a/mysql-test/t/error_simulation.test +++ b/mysql-test/t/error_simulation.test @@ -33,3 +33,19 @@ set tmp_table_size=default; DROP TABLE t1; +--echo # +--echo # Bug #50946: fast index creation still seems to copy the table +--echo # +CREATE TABLE t1 (a INT(100) NOT NULL); +INSERT INTO t1 VALUES (1), (0), (2); +SET SESSION debug='+d,alter_table_only_index_change'; +ALTER TABLE t1 ADD INDEX a(a); +SET SESSION debug=DEFAULT; +SHOW CREATE TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # End of 5.1 tests +--echo # -- cgit v1.2.1 From 4d0e9957acdddf7a07e095ef2e8f53a2cb99b24b Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 28 Apr 2010 15:55:54 +0300 Subject: Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when JOINed during an UPDATE Extended the fix for bug 29310 to multi-table update: When a table is being updated it has two set of fields - fields required for checks of conditions and fields to be updated. A storage engine is allowed not to retrieve columns marked for update. Due to this fact records can't be compared to see whether the data has been changed or not. This makes the server always update records independently of data change. Now when an auto-updatable timestamp field is present and server sees that a table handle isn't going to retrieve write-only fields then all of such fields are marked as to be read to force the handler to retrieve them. --- mysql-test/t/innodb_mysql.test | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 88ca8d42e3d..9564d3b41fb 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -589,4 +589,34 @@ ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b); DROP TABLE t1; + +--echo # +--echo # Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when +--echo # JOINed during an UPDATE +--echo # + +CREATE TABLE t1 (d INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT, b INT, + c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB; + +--echo set up our data elements +INSERT INTO t1 (d) VALUES (1); +INSERT INTO t2 (a,b) VALUES (1,1); +SELECT SECOND(c) INTO @bug47453 FROM t2; + +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; +UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; + +SELECT SLEEP(1); + +UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; + +--echo #should be 0 +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; + +DROP TABLE t1, t2; + + --echo End of 5.1 tests -- cgit v1.2.1 From 7ecad98c45ece1140e9f2cb7627741cde31fa2f7 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 1 Apr 2010 10:15:22 -0300 Subject: Bug#50755: Crash if stored routine def contains version comments The problem was that a syntactically invalid trigger could cause the server to crash when trying to list triggers. The crash would happen due to a mishap in the backup/restore procedure that should protect parser items which are not associated with the trigger. The backup/restore is used to isolate the parse tree (and context) of a statement from the load (and parsing) of a trigger. In this case, a error during the parsing of a trigger could cause the improper backup/restore sequence. The solution is to properly restore the original statement context before the parser is exited due to syntax errors in the trigger body. mysql-test/r/trigger.result: Add test case result for Bug#50755 mysql-test/t/trigger.test: Add test case for Bug#50755 sql/sp_head.cc: Merge sp_head::destroy() and sp_head destructor. Retrieve THD from the LEX so that m_thd is not necessary. sql/sql_lex.cc: Explicitly restore the original environment. --- mysql-test/t/trigger.test | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 368271f1fb2..bcbca4d2139 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -2439,4 +2439,35 @@ UPDATE t1 SET id=NULL; DROP TRIGGER t1_bu; DROP TABLE t1,t2; +--echo # +--echo # Bug#50755: Crash if stored routine def contains version comments +--echo # + +--disable_warnings +DROP DATABASE IF EXISTS db1; +DROP TRIGGER IF EXISTS trg1; +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE DATABASE db1; +USE db1; + +CREATE TABLE t1 (b INT); +CREATE TABLE t2 (a INT); + +CREATE TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERT/*!INTO*/t1 VALUES (1); +--echo # Used to crash +SHOW TRIGGERS IN db1; +--error ER_PARSE_ERROR +INSERT INTO t2 VALUES (1); +SELECT * FROM t1; + +--echo # Work around Bug#45235 +let $MYSQLD_DATADIR = `select @@datadir`; +--remove_file $MYSQLD_DATADIR/db1/t2.TRG +--remove_file $MYSQLD_DATADIR/db1/trg1.TRN + +DROP DATABASE db1; +USE test; + --echo End of 5.1 tests. -- cgit v1.2.1 From ab1242b9e30c34e50f28146d2ff9953ec40749ee Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 1 Apr 2010 18:49:02 +0400 Subject: BUG#40980 - Drop table can remove another MyISAM table's data and index files It was possible if DATA/INDEX DIRECTORY is pointing to symlinked MySQL data home directory. Do not allow to drop data/index files implicitly symlinked to data home directory. For such tables remove symlink only. mysql-test/r/symlink.result: A test case for BUG#40980. mysql-test/t/symlink.test: A test case for BUG#40980. storage/myisam/mi_delete_table.c: Do not allow to drop data/index files implicitly symlinked to data home directory. For such tables remove symlink only. --- mysql-test/t/symlink.test | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index c805dd40fe8..073fcd28246 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -249,4 +249,26 @@ eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTO DROP TABLE t1; SET @@SQL_MODE=@OLD_SQL_MODE; +--echo # +--echo # BUG#40980 - Drop table can remove another MyISAM table's +--echo # data and index files +--echo # +--mkdir $MYSQL_TMP_DIR/mysql +--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +eval CREATE TABLE user(a INT) DATA DIRECTORY='$MYSQL_TMP_DIR/mysql' + INDEX DIRECTORY='$MYSQL_TMP_DIR/mysql'; +FLUSH TABLE user; +--echo # Symlinking mysql database to tmpdir +--remove_file $MYSQL_TMP_DIR/mysql/user.MYD +--remove_file $MYSQL_TMP_DIR/mysql/user.MYI +--rmdir $MYSQL_TMP_DIR/mysql +--exec ln -s $MYSQLD_DATADIR/mysql $MYSQL_TMP_DIR/mysql +FLUSH TABLE mysql.user; +DROP TABLE user; +FLUSH TABLE mysql.user; +--disable_result_log +SELECT * FROM mysql.user; +--enable_result_log +--remove_file $MYSQL_TMP_DIR/mysql + --echo End of 5.1 tests -- cgit v1.2.1 From ab8ff15cd148a0a5855d2474db78c05ec28f20c7 Mon Sep 17 00:00:00 2001 From: Anurag Shekhar Date: Fri, 2 Apr 2010 01:35:36 +0530 Subject: Bug #47904 Incorrect results w/ table subquery, derived SQs, and LEFT JOIN on index 'my_decimal' class has two members which can be used to access the value. The member variable buf (inherited from parent class decimal_t) is set to member variable buffer so that both are pointing to same value. Item_copy_decimal::copy() uses memcpy to clone 'my_decimal'. The member buffer is declared as an array and memcpy results in copying the values of the array, but the inherited member buf, which should be pointing at the begining of the array 'buffer' starts pointing to the begining of buffer in original object (which is being cloned). Further updates on 'my_decimal' updates only the inherited member 'buf' but leaves buffer unchanged. Later when the new object (which now holds a inconsistent value) is cloned again using proper cloning function 'my_decimal2decimal' the buf pointer is fixed resulting in loss of the current value. Using my_decimal2decimal instead of memcpy in Item_copy_decimal::copy() fixed this problem. mysql-test/r/subselect.result: Updated result file after addding test case for bug#47904. mysql-test/t/subselect.test: Added test case for bug#47904. sql/item.cc: Memcopy shouldn't be used to clone my_decimal. Use my_decimal2decimal instead. --- mysql-test/t/subselect.test | 83 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 09a7ca22e44..c58faf60010 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3618,3 +3618,86 @@ DROP TABLE t1; --echo End of 5.1 tests. + +# +# Bug #47904 Incorrect results w/ table subquery, derived SQs, and LEFT JOIN on index +# + +--echo Set up test tables. +CREATE TABLE t1 ( + t1_id INT UNSIGNED, + + PRIMARY KEY(t1_id) +) Engine=MyISAM; + +INSERT INTO t1 (t1_id) VALUES (1), (2), (3), (4), (5); + +CREATE TABLE t2 SELECT * FROM t1; + +CREATE TABLE t3 ( + t3_id INT UNSIGNED AUTO_INCREMENT, + t1_id INT UNSIGNED, + amount DECIMAL(16,2), + + PRIMARY KEY(t3_id), + KEY(t1_id) +) Engine=MyISAM; + +INSERT INTO t3 (t1_id, t3_id, amount) + VALUES (1, 1, 100.00), (2, 2, 200.00), (4, 4, 400.00); + +--echo This is the 'inner query' running by itself. +--echo Produces correct results. +SELECT + t1.t1_id, + IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount +FROM + t1 + LEFT JOIN t2 ON t2.t1_id=t1.t1_id +GROUP BY + t1.t1_id +; + +--echo SELECT * FROM (the same inner query) +--echo Produces correct results. +SELECT * FROM ( +SELECT + t1.t1_id, + IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount +FROM + t1 + LEFT JOIN t2 ON t2.t1_id=t1.t1_id +GROUP BY + t1.t1_id +) AS t; + +--echo Now make t2.t1_id part of a key. +ALTER TABLE t2 ADD PRIMARY KEY(t1_id); + +--echo Same inner query by itself. +--echo Still correct results. +SELECT + t1.t1_id, + IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount +FROM + t1 + LEFT JOIN t2 ON t2.t1_id=t1.t1_id +GROUP BY + t1.t1_id; + +--echo SELECT * FROM (the same inner query), now with indexes on the LEFT JOIN +SELECT * FROM ( +SELECT + t1.t1_id, + IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount +FROM + t1 + LEFT JOIN t2 ON t2.t1_id=t1.t1_id +GROUP BY + t1.t1_id +) AS t; + + +DROP TABLE t3; +DROP TABLE t2; +DROP TABLE t1; -- cgit v1.2.1 From 59baf97d56ab2a06fd6cde5509ba933c102fb203 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Thu, 1 Apr 2010 14:42:40 -0700 Subject: Post-review fixes. --- mysql-test/t/key_cache.test | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index c7b3a318c76..7d5e33d40de 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -469,6 +469,8 @@ insert into t2 values (7000, 3, 'yyyy'); select * from information_schema.key_caches where partition_number is null; set global keycache1.key_cache_block_size=8*1024; +--replace_column 6 # 7 # +select * from information_schema.key_caches where partition_number is null; insert into t2 values (8000, 3, 'yyyy'); --replace_column 6 # 7 # select * from information_schema.key_caches where partition_number is null; -- cgit v1.2.1 From e2a546aef46834b8250b3129ee87e944b4dd6ccb Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Sat, 3 Apr 2010 00:30:22 +0400 Subject: Bug #40625: Concat fails on DOUBLE values in a Stored Procedure, while DECIMAL works Selecting of the CONCAT(......) result into a user variable may return wrong data. Item_func_concat::val_str contains a number of memory allocation-saving tricks. One of them concatenates strings inplace inserting the value of one string at the beginning of the other string. However, this trick didn't care about strings those points to the same data buffer: this is possible when a CONCAT() parameter is a stored procedure variable - Item_sp_variable::val_str() uses the intermediate Item_sp_variable::str_value field, where it may store a reference to an external buffer. The Item_func_concat::val_str function has been modified to take into account val_str functions (such as Item_sp_variable::val_str) that return a pointer to an internal Item member variable that may reference to a buffer provided. mysql-test/r/func_concat.result: Test case for the bug #40625. mysql-test/t/func_concat.test: Test case for the bug #40625. sql/item_strfunc.cc: Bug #40625: Concat fails on DOUBLE values in a Stored Procedure, while DECIMAL works The Item_func_concat::val_str function has been modified to take into account val_str functions (such as Item_sp_variable::val_str) that return a pointer to an internal Item member variable that may reference to a buffer provided. --- mysql-test/t/func_concat.test | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test index e24b4354b61..e56d1121808 100644 --- a/mysql-test/t/func_concat.test +++ b/mysql-test/t/func_concat.test @@ -124,4 +124,24 @@ SELECT @query; DROP PROCEDURE p1; +--echo # +--echo # Bug #40625: Concat fails on DOUBLE values in a Stored Procedure, +--echo # while DECIMAL works +--echo # + +DELIMITER //; +CREATE PROCEDURE p1() +BEGIN + DECLARE v1 DOUBLE(10,3); + SET v1= 100; + SET @s = CONCAT('########################################', 40 , v1); + SELECT @s; +END;// +DELIMITER ;// + +CALL p1(); +CALL p1(); + +DROP PROCEDURE p1; + --echo # End of 5.1 tests -- cgit v1.2.1 From fedbda3f2fe808aa32b8acdecd282aead778711e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 5 Apr 2010 11:50:31 +0200 Subject: fixed a bug in handling mysql_native_password specified explicitly: CREATE USER mysqltest_up1 IDENTIFIED VIA mysql_native_password pointers were not always fixed, salt wasn't updated --- mysql-test/t/connect.test | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index 255a4634bca..13008b67312 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -328,6 +328,34 @@ if ($error) --disconnect extracon2 --connection default +# +# A couple of plugin tests - for builtin plugins only +# +CREATE USER mysqltest_up1 IDENTIFIED VIA mysql_native_password using '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'; +CREATE USER mysqltest_up2 IDENTIFIED VIA mysql_old_password using '09301740536db389'; + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR +connect(pcon1,localhost,mysqltest_up1,foo,,$MASTER_EXTRA_PORT,); + +connect(pcon2,localhost,mysqltest_up1,bar,,$MASTER_EXTRA_PORT,); +connection pcon2; +select user(), current_user(); +disconnect pcon2; + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR +connect(pcon3,localhost,mysqltest_up2,newpw,,$MASTER_EXTRA_PORT,); + +connect(pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_EXTRA_PORT,); +connection pcon4; +select user(), current_user(); +disconnect pcon4; + +connection default; +DROP USER mysqltest_up1@'%'; +DROP USER mysqltest_up2@'%'; + # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc -- cgit v1.2.1 From c1ad5072b842c25732c278f0f7b60bccf8a23a94 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Mon, 5 Apr 2010 16:10:26 +0500 Subject: Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355 The problem is that we can not use make_cond_for_table(). This function relies on used_tables() condition which is not set properly for subqueries. As result subquery is not filtered out. The fix is to use remove_eq_conds() function instead of make_cond_for_table() func. 'remove_eq_conds()' algorithm relies on const_item() value and it allows to handle subqueries in right way. mysql-test/r/having.result: test case mysql-test/t/having.test: test case sql/sql_select.cc: The fix is to use remove_eq_conds() function instead of make_cond_for_table() function. --- mysql-test/t/having.test | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index b68ba69b975..65bf9518a5c 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -498,4 +498,49 @@ HAVING (table2.f2 = 8); DROP TABLE t1; +--echo # +--echo # Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355 +--echo # +CREATE TABLE t1(f1 INT, f2 INT); +INSERT INTO t1 VALUES (10,8); +CREATE TABLE t2 (f1 INT); +INSERT INTO t2 VALUES (5); + +SELECT COUNT(f1) FROM t2 +HAVING (7, 9) IN (SELECT f1, MIN(f2) FROM t1); + +DROP TABLE t1, t2; + +CREATE TABLE t1 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t1 VALUES (16,'f'); +INSERT INTO t1 VALUES (16,'f'); +CREATE TABLE t2 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t2 VALUES (13,'f'); +INSERT INTO t2 VALUES (20,'f'); +CREATE TABLE t3 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t3 VALUES (7,'f'); + +SELECT t1.f2 FROM t1 +STRAIGHT_JOIN (t2 JOIN t3 ON t3.f2 = t2.f2 ) ON t3 .f2 = t2 .f2 +HAVING ('v', 'i') NOT IN (SELECT f2, MIN(f2) FROM t1) +ORDER BY f2; + +DROP TABLES t1,t2,t3; + +--echo # +--echo # Bug#52340 Segfault: read_cached_record (tab=0x94a2634) at sql_select.cc:14411 +--echo # +CREATE TABLE t1 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t1 VALUES (16,'d'); +CREATE TABLE t2 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t2 VALUES (13,'e'); +INSERT INTO t2 VALUES (20,'d'); + +SELECT MAX(t2.f2) FROM t2 JOIN t1 ON t1.f2 +HAVING ('e' , 'd') IN +(SELECT ts1.f2, ts2.f2 FROM t2 ts1 JOIN t2 ts2 ON ts1.f1) +ORDER BY t1.f2; + +DROP TABLE t1,t2; + --echo End of 5.0 tests -- cgit v1.2.1 From 0b23966fe2b5f2147271b690e41f2e671f89d9fd Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 6 Apr 2010 20:36:06 +0200 Subject: fixes for builbot failures mysql-test/t/connect.test: replace the port correctly sql/set_var.cc: opensolaris gcc (or just an old gcc ?) does not like offsetof() as a case label. --- mysql-test/t/connect.test | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index 13008b67312..a8c8b659c3c 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -336,18 +336,18 @@ CREATE USER mysqltest_up2 IDENTIFIED VIA mysql_old_password using '09301740536db --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR -connect(pcon1,localhost,mysqltest_up1,foo,,$MASTER_EXTRA_PORT,); - -connect(pcon2,localhost,mysqltest_up1,bar,,$MASTER_EXTRA_PORT,); +connect(pcon1,localhost,mysqltest_up1,foo,,$MASTER_MYPORT,); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +connect(pcon2,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,); connection pcon2; select user(), current_user(); disconnect pcon2; --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR -connect(pcon3,localhost,mysqltest_up2,newpw,,$MASTER_EXTRA_PORT,); - -connect(pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_EXTRA_PORT,); +connect(pcon3,localhost,mysqltest_up2,newpw,,$MASTER_MYPORT,); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +connect(pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,); connection pcon4; select user(), current_user(); disconnect pcon4; -- cgit v1.2.1 From 8e122db92d0a60670e421903c32213524cd54fdf Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 7 Apr 2010 17:05:09 +0200 Subject: test fix for sol-sparc-32 --- mysql-test/t/key_cache.test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index 7d5e33d40de..274e47ec6ca 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -282,7 +282,7 @@ select * from t2; update t1 set p=3 where p=1; update t2 set i=2 where i=1; ---replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED +--replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED show status like 'key_%'; --replace_column 7 # select * from information_schema.key_caches where partition_number is null; @@ -314,7 +314,7 @@ select * from t2; update t1 set p=3 where p=1; update t2 set i=2 where i=1; ---replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED +--replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1788 KEY_BLOCKS_UNUSED show status like 'key_%'; --replace_column 7 # select * from information_schema.key_caches where partition_number is null; @@ -339,7 +339,7 @@ select * from t2; update t1 set p=3 where p=1; update t2 set i=2 where i=1; ---replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED +--replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED show status like 'key_%'; --replace_column 7 # select * from information_schema.key_caches where partition_number is null; -- cgit v1.2.1 From 04ff96f7891cf4a714a3f60a4ec15b5ead7a3f31 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Thu, 8 Apr 2010 12:47:31 +0300 Subject: Fixed syntax error and some timeing issues in test suite mysql-test/r/func_time.result: Updated result mysql-test/t/func_time.test: sysdate() could be same even with one sleep(1) in between. storage/maria/ma_loghandler.c: Fixed syntax error --- mysql-test/t/func_time.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index b9da946a55f..2f9a48ffd6a 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -650,7 +650,7 @@ drop table t1; SET GLOBAL log_bin_trust_function_creators = 0; create table t1 (a datetime, i int, b datetime); -insert into t1 select sysdate(), sleep(1), sysdate() from dual; +insert into t1 select sysdate(), sleep(2), sysdate() from dual; select a != b from t1; drop table t1; -- cgit v1.2.1 From e24e1668bc112afe4b4f6b3dc4d5b8d10635f60b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 8 Apr 2010 14:10:05 +0200 Subject: MWL#43 CREATE TABLE options (by Sanja) Docs/sp-imp-spec.txt: New sql_mode added. include/my_base.h: Flag in frm of create options. libmysqld/CMakeLists.txt: New files added. libmysqld/Makefile.am: New files added. mysql-test/r/events_bugs.result: New sql_mode added. mysql-test/r/information_schema.result: New sql_mode added. mysql-test/r/sp.result: New sql_mode added. mysql-test/r/system_mysql_db.result: New sql_mode added. mysql-test/suite/funcs_1/r/is_columns_mysql.result: New sql_mode added. mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result: New sql_mode added. mysql-test/t/events_bugs.test: New sql_mode added. mysql-test/t/sp.test: New sql_mode added. scripts/mysql_system_tables.sql: New sql_mode added. scripts/mysql_system_tables_fix.sql: New sql_mode added. sql/CMakeLists.txt: New files added. sql/Makefile.am: New files added. sql/event_db_repository.cc: New sql_mode added. sql/field.cc: Create options support added. sql/field.h: Create options support added. sql/ha_partition.cc: Create options support added. sql/handler.cc: Create options support added. sql/handler.h: Create options support added. sql/log_event.h: New sql_mode added. sql/mysql_priv.h: New sql_mode added. sql/mysqld.cc: New sql_mode added. sql/share/errmsg.txt: New error messages added. sql/sp.cc: New sql_mode added. sql/sp_head.cc: Create options support added. sql/sql_class.cc: Create options support added. Debug added. sql/sql_class.h: Create options support added. sql/sql_insert.cc: my_safe_a* moved to mysqld_priv.h sql/sql_lex.h: Create options support added. sql/sql_parse.cc: Create options support added. sql/sql_show.cc: Create options support added. sql/sql_table.cc: Create options support added. sql/sql_view.cc: New sql_mode added. sql/sql_yacc.yy: Create options support added. sql/structs.h: Create options support added. sql/table.cc: Create options support added. sql/table.h: Create options support added. sql/unireg.cc: Create options support added. storage/example/ha_example.cc: Create options example. storage/example/ha_example.h: Create options example. storage/pbxt/src/discover_xt.cc: Create options support added. --- mysql-test/t/create_options.test | 68 ++++++++++++++++++++++++++++++++++++++++ mysql-test/t/events_bugs.test | 1 - mysql-test/t/plugin.test | 31 ++++++++++++++++++ mysql-test/t/sp.test | 1 - 4 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 mysql-test/t/create_options.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/create_options.test b/mysql-test/t/create_options.test new file mode 100644 index 00000000000..533e6829c00 --- /dev/null +++ b/mysql-test/t/create_options.test @@ -0,0 +1,68 @@ +--disable_warnings +drop table if exists t1; +--enable_warnings + +SET @OLD_SQL_MODE=@@SQL_MODE; +SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS'; + +create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1='1v1'; +show create table t1; +drop table t1; + +--echo #reassiginig options in the same line +create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1 TKEY1=DEFAULT tkey1=1v2 tkey2=2v1; +show create table t1; + +-- echo #add option +alter table t1 tkey4=4v1; +show create table t1; + +--echo #remove options +alter table t1 tkey3=DEFAULT tkey4=DEFAULT; +show create table t1; + +drop table t1; + +create table t1 (a int fkey1=v1, key akey (a) kkey1=v1) tkey1=1v1 tkey1=1v2 TKEY1=DEFAULT tkey2=2v1 tkey3=3v1; +show create table t1; + +--echo #change field with option with the same value +alter table t1 change a a int `FKEY1`='v1'; +show create table t1; +--echo #change field with option with a different value +alter table t1 change a a int fkey1=v2; +show create table t1; +--echo #new column no options +alter table t1 add column b int; +show create table t1; +--echo #new key with options +alter table t1 add key bkey (b) kkey2=v1; +show create table t1; +--echo #new column with options +alter table t1 add column c int fkey1=v1 fkey2=v2; +show create table t1; +--echo #new key no options +alter table t1 add key ckey (c); +show create table t1; +--echo #drop column +alter table t1 drop b; +show create table t1; +--echo #add column with options after delete +alter table t1 add column b int fkey2=v1; +show create table t1; +--echo #add key +alter table t1 add key bkey (b) kkey2=v2; +show create table t1; +drop table t1; + +#numeric (unquoted) value +create table t1 (a int) tkey1=100; +show create table t1; +drop table t1; + +--echo #error on unknown option +SET SQL_MODE=''; +--error ER_UNKNOWN_OPTION +create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1; + +SET @@SQL_MODE=@OLD_SQL_MODE; diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test index 81397b333f9..f2a82f40cff 100644 --- a/mysql-test/t/events_bugs.test +++ b/mysql-test/t/events_bugs.test @@ -1204,7 +1204,6 @@ create event e1 on schedule every 1 day do select 1; select @@sql_mode; set @@sql_mode= @old_mode; # Rename SQL modes that differ in name between the server and the table definition. -select replace(@full_mode, '?', 'NOT_USED') into @full_mode; select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode; select name from mysql.event where name = 'p' and sql_mode = @full_mode; drop event e1; diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index 0bf86b47dd7..eedaebc25db 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -84,4 +84,35 @@ set session sql_mode=@old_sql_mode; --error ER_INCORRECT_GLOBAL_LOCAL_VAR set session old=bla; +############################################################### +# engine-specific clauses in the CREATE TABLE: + +--echo #legal values +CREATE TABLE t1 ( a int complex='c,f,f,f' ) ENGINE=example ULL=10000 STR='dskj' one_or_two='one' YESNO=0; +show create table t1; +drop table t1; + +SET @OLD_SQL_MODE=@@SQL_MODE; +SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS'; + +--echo #illegal value fixed +CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS; +show create table t1; + +--echo #alter table +alter table t1 ULL=10000000; +show create table t1; +alter table t1 change a a int complex='c,c,c'; +show create table t1; +drop table t1; + + +--echo #illegal value error +SET SQL_MODE=''; +--error ER_BAD_OPTION_VALUE +CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS; + +SET @@SQL_MODE=@OLD_SQL_MODE; + + UNINSTALL PLUGIN example; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 5cf050146dd..db8077bbbef 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -8210,7 +8210,6 @@ call p(); select @@sql_mode; set @@sql_mode= @old_mode; # Rename SQL modes that differ in name between the server and the table definition. -select replace(@full_mode, '?', 'NOT_USED') into @full_mode; select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode; select name from mysql.proc where name = 'p' and sql_mode = @full_mode; drop procedure p; -- cgit v1.2.1 From cda2c0ced46ceccfcef254ea6ce6a86d066c1341 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 8 Apr 2010 19:19:01 +0200 Subject: fixes for buildbot: update test results fix compilation failure on windows fix for ps-protocol mysql-test/r/plugin.result: make sure the PS handle is closed mysql-test/t/plugin.test: make sure the PS handle is closed sql/mysqld.cc: compilation failure: lable without a statement. sql/sql_plugin.cc: make plugin lock and plugin unlock use the same format of the dbug info string. print the ref_count *after* the lock and *after* the unlock. --- mysql-test/t/plugin.test | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index eedaebc25db..a7f3c693389 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -106,13 +106,18 @@ alter table t1 change a a int complex='c,c,c'; show create table t1; drop table t1; - --echo #illegal value error SET SQL_MODE=''; --error ER_BAD_OPTION_VALUE CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS; - SET @@SQL_MODE=@OLD_SQL_MODE; - +# +# The only preparable statement above was CREATE TABLE. +# We need to prepare another statement here to force the +# previous one to be deallocated (mysqltest reuses the same handle) +# and to unlock all thread-local plugin locks. Otherwise it won't +# uninstall. +# +select 1; UNINSTALL PLUGIN example; -- cgit v1.2.1 From f5692f21f98ed81de4b5f8e95a6e9c68a1665fb5 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 12 Apr 2010 14:56:24 +0300 Subject: Remove outdated InnoDB Plugin tests from mysql-test/suite/innodb, the InnoDB Plugin tests are now in mysql-test/suite/innodb_plugin. Move InnoDB tests to the innodb suite at mysql-test/suite/innodb. --- mysql-test/t/disabled.def | 1 - mysql-test/t/innodb-autoinc-44030.test | 34 - mysql-test/t/innodb-autoinc.test | 664 ------ mysql-test/t/innodb-lock.test | 102 - mysql-test/t/innodb-master.opt | 1 - mysql-test/t/innodb-replace.test | 22 - mysql-test/t/innodb-semi-consistent-master.opt | 1 - mysql-test/t/innodb-semi-consistent.test | 68 - mysql-test/t/innodb.test | 2567 ----------------------- mysql-test/t/innodb_bug21704.test | 96 - mysql-test/t/innodb_bug34053.test | 50 - mysql-test/t/innodb_bug34300.test | 37 - mysql-test/t/innodb_bug35220.test | 16 - mysql-test/t/innodb_bug38231.test | 112 - mysql-test/t/innodb_bug39438-master.opt | 1 - mysql-test/t/innodb_bug39438.test | 31 - mysql-test/t/innodb_bug40565.test | 10 - mysql-test/t/innodb_bug42101-nonzero-master.opt | 1 - mysql-test/t/innodb_bug42101-nonzero.test | 21 - mysql-test/t/innodb_bug42101.test | 19 - mysql-test/t/innodb_bug44369.test | 21 - mysql-test/t/innodb_bug45357.test | 10 - mysql-test/t/innodb_bug46000.test | 34 - mysql-test/t/innodb_bug47621.test | 57 - mysql-test/t/innodb_bug47777.test | 24 - mysql-test/t/innodb_bug51920.test | 39 - mysql-test/t/innodb_trx_weight.test | 108 - 27 files changed, 4147 deletions(-) delete mode 100644 mysql-test/t/innodb-autoinc-44030.test delete mode 100644 mysql-test/t/innodb-autoinc.test delete mode 100644 mysql-test/t/innodb-lock.test delete mode 100644 mysql-test/t/innodb-master.opt delete mode 100644 mysql-test/t/innodb-replace.test delete mode 100644 mysql-test/t/innodb-semi-consistent-master.opt delete mode 100644 mysql-test/t/innodb-semi-consistent.test delete mode 100644 mysql-test/t/innodb.test delete mode 100644 mysql-test/t/innodb_bug21704.test delete mode 100644 mysql-test/t/innodb_bug34053.test delete mode 100644 mysql-test/t/innodb_bug34300.test delete mode 100644 mysql-test/t/innodb_bug35220.test delete mode 100644 mysql-test/t/innodb_bug38231.test delete mode 100644 mysql-test/t/innodb_bug39438-master.opt delete mode 100644 mysql-test/t/innodb_bug39438.test delete mode 100644 mysql-test/t/innodb_bug40565.test delete mode 100644 mysql-test/t/innodb_bug42101-nonzero-master.opt delete mode 100644 mysql-test/t/innodb_bug42101-nonzero.test delete mode 100644 mysql-test/t/innodb_bug42101.test delete mode 100644 mysql-test/t/innodb_bug44369.test delete mode 100644 mysql-test/t/innodb_bug45357.test delete mode 100644 mysql-test/t/innodb_bug46000.test delete mode 100644 mysql-test/t/innodb_bug47621.test delete mode 100644 mysql-test/t/innodb_bug47777.test delete mode 100644 mysql-test/t/innodb_bug51920.test delete mode 100644 mysql-test/t/innodb_trx_weight.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 5f37dbe2cb6..07462e91696 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,4 +11,3 @@ ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically -innodb-autoinc-44030 : BUG#47621 2009-01-22 svoj MySQL and InnoDB dicts getting out of sync diff --git a/mysql-test/t/innodb-autoinc-44030.test b/mysql-test/t/innodb-autoinc-44030.test deleted file mode 100644 index af2e3015280..00000000000 --- a/mysql-test/t/innodb-autoinc-44030.test +++ /dev/null @@ -1,34 +0,0 @@ --- source include/have_innodb.inc -# embedded server ignores 'delayed', so skip this --- source include/not_embedded.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from -# the index (PRIMARY) -# This test requires a restart of the server -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (null); -INSERT INTO t1 VALUES (null); -ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; -SELECT * FROM t1; -# Restart the server --- source include/restart_mysqld.inc -# The MySQL and InnoDB data dictionaries should now be out of sync. -# The select should print message to the error log -SELECT * FROM t1; -# MySQL have made a change (http://lists.mysql.com/commits/75268) that no -# longer results in the two data dictionaries being out of sync. If they -# revert their changes then this check for ER_AUTOINC_READ_FAILED will need -# to be enabled. Also, see http://bugs.mysql.com/bug.php?id=47621. --- error ER_AUTOINC_READ_FAILED,1467 -INSERT INTO t1 VALUES(null); -ALTER TABLE t1 AUTO_INCREMENT = 3; -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES(null); -SELECT * FROM t1; -DROP TABLE t1; diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test deleted file mode 100644 index ef0359b78b0..00000000000 --- a/mysql-test/t/innodb-autoinc.test +++ /dev/null @@ -1,664 +0,0 @@ --- source include/have_innodb.inc -# embedded server ignores 'delayed', so skip this --- source include/not_embedded.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# Bug #34335 -# -CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (9223372036854775807, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -## Test AUTOINC overflow -## - -# TINYINT -CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (127, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (255, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -# SMALLINT -# -CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (32767, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (65535, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -# MEDIUMINT -# -CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (8388607, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (16777215, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -# INT -# -CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (2147483647, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (4294967295, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -# BIGINT -# -CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (9223372036854775807, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (18446744073709551615, null); --- error ER_AUTOINC_READ_FAILED,1467 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Bug 37531 -# After truncate, auto_increment behaves incorrectly for InnoDB -# -CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -SHOW CREATE TABLE t1; -TRUNCATE TABLE t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; - -# -# Deleting all records should not reset the AUTOINC counter. -# -CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -SHOW CREATE TABLE t1; -DELETE FROM t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; - -# -# Bug 38839 -# Reset the last value generated at end of statement -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL, 1); -DELETE FROM t1 WHERE c1 = 1; -INSERT INTO t1 VALUES (2,1); -INSERT INTO t1 VALUES (NULL,8); -SELECT * FROM t1; -DROP TABLE t1; -# Bug 38839 -- same as above but for multi value insert -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL, 1); -DELETE FROM t1 WHERE c1 = 1; -INSERT INTO t1 VALUES (2,1), (NULL, 8); -INSERT INTO t1 VALUES (NULL,9); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Test changes to AUTOINC next value calculation -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL),(5),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# Test with SIGNED INT column, by inserting a 0 for the first column value -# 0 is treated in the same was NULL. -# Reset the AUTOINC session variables -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(0); -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -SET @@INSERT_ID=400; -# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# Test with SIGNED INT column -# Reset the AUTOINC session variables -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-1); -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# Test with UNSIGNED INT column, single insert -# The sign in the value is ignored and a new column value is generated -# Reset the AUTOINC session variables -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-1); -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -INSERT INTO t1 VALUES (-2); -INSERT INTO t1 VALUES (NULL); -INSERT INTO t1 VALUES (2); -INSERT INTO t1 VALUES (NULL); -INSERT INTO t1 VALUES (250); -INSERT INTO t1 VALUES (NULL); -SELECT * FROM t1; -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# Test with UNSIGNED INT column, multi-value inserts -# The sign in the value is ignored and a new column value is generated -# Reset the AUTOINC session variables -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-1); -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Check for overflow handling when increment is > 1 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (9223372036854775794); #-- 2^63 - 14 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -# This should just fit -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Check for overflow handling when increment and offser are > 1 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -# This should fail because of overflow but it doesn't, it seems to be -# a MySQL server bug. It wraps around to 0 for the last value. -# See MySQL Bug# 39828 -# -# Instead of wrapping around, it asserts when MySQL is compiled --with-debug -# (see sql/handler.cc:handler::update_auto_increment()). Don't test for -# overflow until Bug #39828 is fixed. -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -#INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -#else -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -#endif -SELECT * FROM t1; -DROP TABLE t1; - -# -# Check for overflow handling when increment and offset are odd numbers -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; -SHOW VARIABLES LIKE "%auto_inc%"; -# This should fail because of overflow but it doesn't. It fails with -# a duplicate entry message because of a MySQL server bug, it wraps -# around. See MySQL Bug# 39828, once MySQL fix the bug we can replace -# the ER_DUP_ENTRY, 1062 below with the appropriate error message -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -# Still need to fix this error code, error should mention overflow -#-- error ER_DUP_ENTRY,1062 -#INSERT INTO t1 VALUES (NULL),(NULL), (NULL); -#else -INSERT INTO t1 VALUES (NULL),(NULL); -#endif -SELECT * FROM t1; -DROP TABLE t1; - -# Check for overflow handling when increment and offset are odd numbers -# and check for large -ve numbers -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES(-9223372036854775806); #-- -2^63 + 2 -INSERT INTO t1 VALUES(-9223372036854775807); #-- -2^63 + 1 -INSERT INTO t1 VALUES(-9223372036854775808); #-- -2^63 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3; -SHOW VARIABLES LIKE "%auto_inc%"; -INSERT INTO t1 VALUES (NULL),(NULL), (NULL); -SELECT * FROM t1; -DROP TABLE t1; -# -# Check for overflow handling when increment and offset are very -# large numbers 2^60 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; -SHOW VARIABLES LIKE "%auto_inc%"; -# This should fail because of overflow but it doesn't. It wraps around -# and the autoinc values look bogus too. -# See MySQL Bug# 39828, once MySQL fix the bug we can enable the error -# code expected test. -# -- error ER_AUTOINC_READ_FAILED,1467 -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -#-- error ER_AUTOINC_READ_FAILED,1467 -#INSERT INTO t1 VALUES (NULL),(NULL); -#else -INSERT INTO t1 VALUES (NULL); -#endif -SELECT * FROM t1; -DROP TABLE t1; - -# -# Check for floating point autoinc column handling -# -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL, 1); -INSERT INTO t1 VALUES(NULL, 2); -SELECT * FROM t1; -ALTER TABLE t1 CHANGE c1 c1 SERIAL; -SELECT * FROM t1; -INSERT INTO t1 VALUES(NULL, 3); -INSERT INTO t1 VALUES(NULL, 4); -SELECT * FROM t1; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL, 1); -INSERT INTO t1 VALUES(NULL, 2); -SELECT * FROM t1; -ALTER TABLE t1 CHANGE c1 c1 SERIAL; -SELECT * FROM t1; -INSERT INTO t1 VALUES(NULL, 3); -INSERT INTO t1 VALUES(NULL, 4); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Bug# 42714: AUTOINC column calculated next value not greater than highest -# value stored in table. -# -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5; -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -CREATE TABLE t1 ( - a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - b INT(10) UNSIGNED NOT NULL, - c ENUM('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (a)) ENGINE = InnoDB; -CREATE TABLE t2 ( - m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - n INT(10) UNSIGNED NOT NULL, - o enum('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (m)) ENGINE = InnoDB; -INSERT INTO t2 (n,o) VALUES - (1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'), - (3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false'); -SHOW CREATE TABLE t2; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; -SELECT * FROM t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SELECT * FROM t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SELECT * FROM t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -DROP TABLE t2; -# -# 43203: Overflow from auto incrementing causes server segv -# - -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -CREATE TABLE t1( - c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT - PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -CREATE TABLE t2( - c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT - PRIMARY KEY) ENGINE=InnoDB; --- error ER_DUP_ENTRY,1062 -INSERT INTO t2 SELECT c1 FROM t1; --- error ER_DUP_ENTRY,1467 -INSERT INTO t2 SELECT NULL FROM t1; -DROP TABLE t1; -DROP TABLE t2; - -# If the user has specified negative values for an AUTOINC column then -# InnoDB should ignore those values when setting the table's max value. -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SHOW VARIABLES LIKE "%auto_inc%"; -# TINYINT -CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-127, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-127, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; -# -# SMALLINT -# -CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-32767, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-32757, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; -# -# MEDIUMINT -# -CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-8388607, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-8388607, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; -# -# INT -# -CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-2147483647, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-2147483647, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; -# -# BIGINT -# -CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-9223372036854775807, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-9223372036854775807, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; -# -# End negative number check - -## -# 47125: auto_increment start value is ignored if an index is created -# and engine=innodb -# -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB; -CREATE INDEX i1 on t1(c2); -SHOW CREATE TABLE t1; -INSERT INTO t1 (c2) values (0); -SELECT * FROM t1; -DROP TABLE t1; - -## -# 49032: Use the correct function to read the AUTOINC column value -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; -INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); -# Restart the server --- source include/restart_mysqld.inc -INSERT INTO t1(C2) VALUES ('innodb'); -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; -INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); -# Restart the server --- source include/restart_mysqld.inc -INSERT INTO t1(C2) VALUES ('innodb'); -SHOW CREATE TABLE t1; -DROP TABLE t1; - -## -# 47720: REPLACE INTO Autoincrement column with negative values -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t1 SET c1 = 1; -SHOW CREATE TABLE t1; -INSERT INTO t1 SET c1 = 2; -INSERT INTO t1 SET c1 = -1; -SELECT * FROM t1; --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 SET c1 = -1; -SHOW CREATE TABLE t1; -REPLACE INTO t1 VALUES (-1); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; - -## -# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL); -INSERT INTO t1 VALUES (4), (5), (6), (NULL); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; diff --git a/mysql-test/t/innodb-lock.test b/mysql-test/t/innodb-lock.test deleted file mode 100644 index eacf7e562be..00000000000 --- a/mysql-test/t/innodb-lock.test +++ /dev/null @@ -1,102 +0,0 @@ --- source include/have_innodb.inc - -# -# Check and select innodb lock type -# - -set global innodb_table_locks=1; - -select @@innodb_table_locks; - -# -# Testing of explicit table locks with enforced table locks -# - -connect (con1,localhost,root,,); -connect (con2,localhost,root,,); - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# Testing of explicit table locks with enforced table locks -# - -set @@innodb_table_locks=1; - -connection con1; -create table t1 (id integer, x integer) engine=INNODB; -insert into t1 values(0, 0); -set autocommit=0; -SELECT * from t1 where id = 0 FOR UPDATE; - -connection con2; -set autocommit=0; - -# The following statement should hang because con1 is locking the page ---send -lock table t1 write; ---sleep 2 - -connection con1; -update t1 set x=1 where id = 0; -select * from t1; -commit; - -connection con2; -reap; -update t1 set x=2 where id = 0; -commit; -unlock tables; - -connection con1; -select * from t1; -commit; - -drop table t1; - -# -# Try with old lock method (where LOCK TABLE is ignored by InnoDB) -# - -set @@innodb_table_locks=0; - -create table t1 (id integer primary key, x integer) engine=INNODB; -insert into t1 values(0, 0),(1,1),(2,2); -commit; -SELECT * from t1 where id = 0 FOR UPDATE; - -connection con2; -set autocommit=0; -set @@innodb_table_locks=0; - -# The following statement should work becase innodb doesn't check table locks -lock table t1 write; - -connection con1; - -# This will be locked by MySQL ---send -update t1 set x=10 where id = 2; ---sleep 2 - -connection con2; - -# Note that we will get a deadlock if we try to select any rows marked -# for update by con1 ! - -SELECT * from t1 where id = 2; -UPDATE t1 set x=3 where id = 2; -commit; -SELECT * from t1; -commit; -unlock tables; - -connection con1; -reap; -commit; -select * from t1; -drop table t1; - -# End of 4.1 tests diff --git a/mysql-test/t/innodb-master.opt b/mysql-test/t/innodb-master.opt deleted file mode 100644 index 4901efb416c..00000000000 --- a/mysql-test/t/innodb-master.opt +++ /dev/null @@ -1 +0,0 @@ ---binlog_cache_size=32768 --innodb_lock_wait_timeout=1 diff --git a/mysql-test/t/innodb-replace.test b/mysql-test/t/innodb-replace.test deleted file mode 100644 index 8c3aacde5e8..00000000000 --- a/mysql-test/t/innodb-replace.test +++ /dev/null @@ -1,22 +0,0 @@ --- source include/have_innodb.inc -# embedded server ignores 'delayed', so skip this --- source include/not_embedded.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# Bug #1078 -# -create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb; -select * from t1; ---error ER_DELAYED_NOT_SUPPORTED -replace delayed into t1 (c1, c2) values ( "text1","11"); -select * from t1; ---error ER_DELAYED_NOT_SUPPORTED -replace delayed into t1 (c1, c2) values ( "text1","12"); -select * from t1; -drop table t1; - -# End of 4.1 tests diff --git a/mysql-test/t/innodb-semi-consistent-master.opt b/mysql-test/t/innodb-semi-consistent-master.opt deleted file mode 100644 index e76299453d3..00000000000 --- a/mysql-test/t/innodb-semi-consistent-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_lock_wait_timeout=2 diff --git a/mysql-test/t/innodb-semi-consistent.test b/mysql-test/t/innodb-semi-consistent.test deleted file mode 100644 index 61ad7815ca9..00000000000 --- a/mysql-test/t/innodb-semi-consistent.test +++ /dev/null @@ -1,68 +0,0 @@ --- source include/not_embedded.inc --- source include/have_innodb.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# basic tests of semi-consistent reads - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -set binlog_format=mixed; -set session transaction isolation level repeatable read; -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2),(3),(4),(5),(6),(7); -set autocommit=0; -# this should lock the entire table -select * from t1 where a=3 lock in share mode; -connection b; -set binlog_format=mixed; -set session transaction isolation level repeatable read; -set autocommit=0; --- error ER_LOCK_WAIT_TIMEOUT -update t1 set a=10 where a=5; -connection a; -commit; -connection b; -# perform a semi-consisent read (and unlock non-matching rows) -set session transaction isolation level read committed; -update t1 set a=10 where a=5; -connection a; --- error ER_LOCK_WAIT_TIMEOUT -select * from t1 where a=2 for update; -# this should lock the records (1),(2) -select * from t1 where a=2 limit 1 for update; -connection b; -# semi-consistent read will skip non-matching locked rows a=1, a=2 -update t1 set a=11 where a=6; --- error ER_LOCK_WAIT_TIMEOUT -update t1 set a=12 where a=2; --- error ER_LOCK_WAIT_TIMEOUT -update t1 set a=13 where a=1; -connection a; -commit; -connection b; -update t1 set a=14 where a=1; -commit; -connection a; -select * from t1; -drop table t1; - -connection default; -disconnect a; -disconnect b; - -# Bug 39320 -create table t1 (a int, b int) engine=myisam; -create table t2 (c int, d int, key (c)) engine=innodb; -insert into t1 values (1,1); -insert into t2 values (1,2); -connect (a,localhost,root,,); -connection a; -set session transaction isolation level read committed; -delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1); -connection default; -disconnect a; -drop table t1, t2; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test deleted file mode 100644 index 8dcf494406a..00000000000 --- a/mysql-test/t/innodb.test +++ /dev/null @@ -1,2567 +0,0 @@ -####################################################################### -# # -# Please, DO NOT TOUCH this file as well as the innodb.result file. # -# These files are to be modified ONLY BY INNOBASE guys. # -# # -# Use innodb_mysql.[test|result] files instead. # -# # -# If nevertheless you need to make some changes here, please, forward # -# your commit message # -# To: innodb_dev_ww@oracle.com # -# Cc: dev-innodb@mysql.com # -# (otherwise your changes may be erased). # -# # -####################################################################### - --- source include/have_innodb.inc - -let $MYSQLD_DATADIR= `select @@datadir`; - -# Save the original values of some variables in order to be able to -# estimate how much they have changed during the tests. Previously this -# test assumed that e.g. rows_deleted is 0 here and after deleting 23 -# rows it expected that rows_deleted will be 23. Now we do not make -# assumptions about the values of the variables at the beginning, e.g. -# rows_deleted should be 23 + "rows_deleted before the test". This allows -# the test to be run multiple times without restarting the mysqld server. -# See Bug#43309 Test main.innodb can't be run twice --- disable_query_log -SET @innodb_thread_concurrency_orig = @@innodb_thread_concurrency; - -SET @innodb_rows_deleted_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted'); -SET @innodb_rows_inserted_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted'); -SET @innodb_rows_updated_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated'); -SET @innodb_row_lock_waits_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits'); -SET @innodb_row_lock_current_waits_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits'); -SET @innodb_row_lock_time_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time'); -SET @innodb_row_lock_time_max_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max'); -SET @innodb_row_lock_time_avg_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'); --- enable_query_log - ---disable_warnings -drop table if exists t1,t2,t3,t4; -drop database if exists mysqltest; ---enable_warnings - -# -# Small basic test with ignore -# - -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; - -insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); -select id, code, name from t1 order by id; - -update ignore t1 set id = 8, name = 'Sinisa' where id < 3; -select id, code, name from t1 order by id; -update ignore t1 set id = id + 10, name = 'Ralph' where id < 4; -select id, code, name from t1 order by id; - -drop table t1; - -# -# A bit bigger test -# The 'replace_column' statements are needed because the cardinality calculated -# by innodb is not always the same between runs -# - -CREATE TABLE t1 ( - id int(11) NOT NULL auto_increment, - parent_id int(11) DEFAULT '0' NOT NULL, - level tinyint(4) DEFAULT '0' NOT NULL, - PRIMARY KEY (id), - KEY parent_id (parent_id), - KEY level (level) -) engine=innodb; -INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); -update t1 set parent_id=parent_id+100; -select * from t1 where parent_id=102; -update t1 set id=id+1000; --- error ER_DUP_ENTRY,1022 -update t1 set id=1024 where id=1009; -select * from t1; -update ignore t1 set id=id+1; # This will change all rows -select * from t1; -update ignore t1 set id=1023 where id=1010; -select * from t1 where parent_id=102; ---replace_column 9 # -explain select level from t1 where level=1; ---replace_column 9 # -explain select level,id from t1 where level=1; ---replace_column 9 # -explain select level,id,parent_id from t1 where level=1; -select level,id from t1 where level=1; -select level,id,parent_id from t1 where level=1; -optimize table t1; ---replace_column 7 # -show keys from t1; -drop table t1; - -# -# Test replace -# - -CREATE TABLE t1 ( - gesuchnr int(11) DEFAULT '0' NOT NULL, - benutzer_id int(11) DEFAULT '0' NOT NULL, - PRIMARY KEY (gesuchnr,benutzer_id) -) engine=innodb; - -replace into t1 (gesuchnr,benutzer_id) values (2,1); -replace into t1 (gesuchnr,benutzer_id) values (1,1); -replace into t1 (gesuchnr,benutzer_id) values (1,1); -select * from t1; -drop table t1; - -# -# test delete using hidden_primary_key -# - -create table t1 (a int) engine=innodb; -insert into t1 values (1), (2); -optimize table t1; -delete from t1 where a = 1; -select * from t1; -check table t1; -drop table t1; - -create table t1 (a int,b varchar(20)) engine=innodb; -insert into t1 values (1,""), (2,"testing"); -delete from t1 where a = 1; -select * from t1; -create index skr on t1 (a); -insert into t1 values (3,""), (4,"testing"); -analyze table t1; ---replace_column 7 # -show keys from t1; -drop table t1; - - -# Test of reading on secondary key with may be null - -create table t1 (a int,b varchar(20),key(a)) engine=innodb; -insert into t1 values (1,""), (2,"testing"); -select * from t1 where a = 1; -drop table t1; - -# -# Test rollback -# - -create table t1 (n int not null primary key) engine=innodb; -set autocommit=0; -insert into t1 values (4); -rollback; -select n, "after rollback" from t1; -insert into t1 values (4); -commit; -select n, "after commit" from t1; -commit; -insert into t1 values (5); --- error ER_DUP_ENTRY -insert into t1 values (4); -commit; -select n, "after commit" from t1; -set autocommit=1; -insert into t1 values (6); --- error ER_DUP_ENTRY -insert into t1 values (4); -select n from t1; -set autocommit=0; -# -# savepoints -# -begin; -savepoint `my_savepoint`; -insert into t1 values (7); -savepoint `savept2`; -insert into t1 values (3); -select n from t1; -savepoint savept3; -rollback to savepoint savept2; ---error 1305 -rollback to savepoint savept3; -rollback to savepoint savept2; -release savepoint `my_savepoint`; -select n from t1; --- error 1305 -rollback to savepoint `my_savepoint`; ---error 1305 -rollback to savepoint savept2; -insert into t1 values (8); -savepoint sv; -commit; -savepoint sv; -set autocommit=1; -# nop -rollback; -drop table t1; - -# -# Test for commit and FLUSH TABLES WITH READ LOCK -# - -create table t1 (n int not null primary key) engine=innodb; -start transaction; -insert into t1 values (4); -flush tables with read lock; -# -# Current code can't handle a read lock in middle of transaction -#--error 1223; -commit; -unlock tables; -commit; -select * from t1; -drop table t1; - -# -# Testing transactions -# - -create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb; -begin; -insert into t1 values(1,'hamdouni'); -select id as afterbegin_id,nom as afterbegin_nom from t1; -rollback; -select id as afterrollback_id,nom as afterrollback_nom from t1; -set autocommit=0; -insert into t1 values(2,'mysql'); -select id as afterautocommit0_id,nom as afterautocommit0_nom from t1; -rollback; -select id as afterrollback_id,nom as afterrollback_nom from t1; -set autocommit=1; -drop table t1; - -# -# Simple not autocommit test -# - -CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb; -insert into t1 values ('pippo', 12); --- error ER_DUP_ENTRY -insert into t1 values ('pippo', 12); # Gives error -delete from t1; -delete from t1 where id = 'pippo'; -select * from t1; - -insert into t1 values ('pippo', 12); -set autocommit=0; -delete from t1; -rollback; -select * from t1; -delete from t1; -commit; -select * from t1; -drop table t1; - -# -# Test of active transactions -# - -create table t1 (a integer) engine=innodb; -start transaction; -rename table t1 to t2; -create table t1 (b integer) engine=innodb; -insert into t1 values (1); -rollback; -drop table t1; -rename table t2 to t1; -drop table t1; -set autocommit=1; - -# -# The following simple tests failed at some point -# - -CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb; -INSERT INTO t1 VALUES (1, 'Jochen'); -select * from t1; -drop table t1; - -CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb; -set autocommit=0; -INSERT INTO t1 SET _userid='marc@anyware.co.uk'; -COMMIT; -SELECT * FROM t1; -SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk'; -drop table t1; -set autocommit=1; - -# -# Test when reading on part of unique key -# -CREATE TABLE t1 ( - user_id int(10) DEFAULT '0' NOT NULL, - name varchar(100), - phone varchar(100), - ref_email varchar(100) DEFAULT '' NOT NULL, - detail varchar(200), - PRIMARY KEY (user_id,ref_email) -)engine=innodb; - -INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar'); -select * from t1 where user_id=10292; -INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds'); -select * from t1 where user_id=10292; -select * from t1 where user_id>=10292; -select * from t1 where user_id>10292; -select * from t1 where user_id<10292; -drop table t1; - -# -# Test that keys are created in right order -# - -CREATE TABLE t1 (a int not null, b int not null,c int not null, -key(a),primary key(a,b), unique(c),key(a),unique(b)); ---replace_column 7 # -show index from t1; -drop table t1; - -# -# Test of ALTER TABLE and innodb tables -# - -create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); -alter table t1 engine=innodb; -insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4'); -select * from t1; -update t1 set col2='7' where col1='4'; -select * from t1; -alter table t1 add co3 int not null; -select * from t1; -update t1 set col2='9' where col1='2'; -select * from t1; -drop table t1; - -# -# INSERT INTO innodb tables -# - -create table t1 (a int not null , b int, primary key (a)) engine = innodb; -create table t2 (a int not null , b int, primary key (a)) engine = myisam; -insert into t1 VALUES (1,3) , (2,3), (3,3); -select * from t1; -insert into t2 select * from t1; -select * from t2; -delete from t1 where b = 3; -select * from t1; -insert into t1 select * from t2; -select * from t1; -select * from t2; -drop table t1,t2; - -# -# ORDER BY on not primary key -# - -CREATE TABLE t1 ( - user_name varchar(12), - password text, - subscribed char(1), - user_id int(11) DEFAULT '0' NOT NULL, - quota bigint(20), - weight double, - access_date date, - access_time time, - approved datetime, - dummy_primary_key int(11) NOT NULL auto_increment, - PRIMARY KEY (dummy_primary_key) -) ENGINE=innodb; -INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1); -INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2); -INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3); -INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4); -INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5); -select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name; -drop table t1; - -# -# Testing of tables without primary keys -# - -CREATE TABLE t1 ( - id int(11) NOT NULL auto_increment, - parent_id int(11) DEFAULT '0' NOT NULL, - level tinyint(4) DEFAULT '0' NOT NULL, - KEY (id), - KEY parent_id (parent_id), - KEY level (level) -) engine=innodb; -INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1); -INSERT INTO t1 values (179,5,2); -update t1 set parent_id=parent_id+100; -select * from t1 where parent_id=102; -update t1 set id=id+1000; -update t1 set id=1024 where id=1009; -select * from t1; -update ignore t1 set id=id+1; # This will change all rows -select * from t1; -update ignore t1 set id=1023 where id=1010; -select * from t1 where parent_id=102; ---replace_column 9 # -explain select level from t1 where level=1; -select level,id from t1 where level=1; -select level,id,parent_id from t1 where level=1; -select level,id from t1 where level=1 order by id; -delete from t1 where level=1; -select * from t1; -drop table t1; - -# -# Test of index only reads -# -CREATE TABLE t1 ( - sca_code char(6) NOT NULL, - cat_code char(6) NOT NULL, - sca_desc varchar(50), - lan_code char(2) NOT NULL, - sca_pic varchar(100), - sca_sdesc varchar(50), - sca_sch_desc varchar(16), - PRIMARY KEY (sca_code, cat_code, lan_code), - INDEX sca_pic (sca_pic) -) engine = innodb ; - -INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); -select count(*) from t1 where sca_code = 'PD'; -select count(*) from t1 where sca_code <= 'PD'; -select count(*) from t1 where sca_pic is null; -alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); -select count(*) from t1 where sca_code='PD' and sca_pic is null; -select count(*) from t1 where cat_code='E'; - -alter table t1 drop index sca_pic, add index (sca_pic, cat_code); -select count(*) from t1 where sca_code='PD' and sca_pic is null; -select count(*) from t1 where sca_pic >= 'n'; -select sca_pic from t1 where sca_pic is null; -update t1 set sca_pic="test" where sca_pic is null; -delete from t1 where sca_code='pd'; -drop table t1; - -# -# Test of opening table twice and timestamps -# -set @a:=now(); -CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb; -insert into t1 (a) values(1),(2),(3); -select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; -select a from t1 natural join t1 as t2 where b >= @a order by a; -update t1 set a=5 where a=1; -select a from t1; -drop table t1; - -# -# Test with variable length primary key -# -create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb; -insert into t1 values("hello",1),("world",2); -select * from t1 order by b desc; -optimize table t1; ---replace_column 7 # -show keys from t1; -drop table t1; - -# -# Test of create index with NULL columns -# -create table t1 (i int, j int ) ENGINE=innodb; -insert into t1 values (1,2); -select * from t1 where i=1 and j=2; -create index ax1 on t1 (i,j); -select * from t1 where i=1 and j=2; -drop table t1; - -# -# Test min-max optimization -# - -CREATE TABLE t1 ( - a int3 unsigned NOT NULL, - b int1 unsigned NOT NULL, - UNIQUE (a, b) -) ENGINE = innodb; - -INSERT INTO t1 VALUES (1, 1); -SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; -drop table t1; - -# -# Test INSERT DELAYED -# - -CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb; -# Can't test this in 3.23 -# INSERT DELAYED INTO t1 VALUES (1); -INSERT INTO t1 VALUES (1); -SELECT * FROM t1; -DROP TABLE t1; - - -# -# Crash when using many tables (Test case by Jeremy D Zawodny) -# - -create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb; -insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); ---replace_column 9 # -explain select * from t1 where a > 0 and a < 50; -drop table t1; - -# -# Test lock tables -# - -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; -insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); -LOCK TABLES t1 WRITE; ---error ER_DUP_ENTRY -insert into t1 values (99,1,2,'D'),(1,1,2,'D'); -select id from t1; -select id from t1; -UNLOCK TABLES; -DROP TABLE t1; - -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; -insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); -LOCK TABLES t1 WRITE; -begin; ---error ER_DUP_ENTRY -insert into t1 values (99,1,2,'D'),(1,1,2,'D'); -select id from t1; -insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D'); -commit; -select id,id3 from t1; -UNLOCK TABLES; -DROP TABLE t1; - -# -# Test prefix key -# -create table t1 (a char(20), unique (a(5))) engine=innodb; -drop table t1; -create table t1 (a char(20), index (a(5))) engine=innodb; -show create table t1; -drop table t1; - -# -# Test using temporary table and auto_increment -# - -create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb; -insert into t1 values (NULL),(NULL),(NULL); -delete from t1 where a=3; -insert into t1 values (NULL); -select * from t1; -alter table t1 add b int; -select * from t1; -drop table t1; - -#Slashdot bug -create table t1 - ( - id int auto_increment primary key, - name varchar(32) not null, - value text not null, - uid int not null, - unique key(name,uid) - ) engine=innodb; -insert into t1 values (1,'one','one value',101), - (2,'two','two value',102),(3,'three','three value',103); -set insert_id=5; -replace into t1 (value,name,uid) values ('other value','two',102); -delete from t1 where uid=102; -set insert_id=5; -replace into t1 (value,name,uid) values ('other value','two',102); -set insert_id=6; -replace into t1 (value,name,uid) values ('other value','two',102); -select * from t1; -drop table t1; - -# -# Test DROP DATABASE -# - -create database mysqltest; -create table mysqltest.t1 (a int not null) engine= innodb; -insert into mysqltest.t1 values(1); -create table mysqltest.t2 (a int not null) engine= myisam; -insert into mysqltest.t2 values(1); -create table mysqltest.t3 (a int not null) engine= heap; -insert into mysqltest.t3 values(1); -commit; -drop database mysqltest; -# Don't check error message ---error 1049 -show tables from mysqltest; - -# -# Test truncate table with and without auto_commit -# - -set autocommit=0; -create table t1 (a int not null) engine= innodb; -insert into t1 values(1),(2); -truncate table t1; -commit; -truncate table t1; -truncate table t1; -select * from t1; -insert into t1 values(1),(2); -delete from t1; -select * from t1; -commit; -drop table t1; -set autocommit=1; - -create table t1 (a int not null) engine= innodb; -insert into t1 values(1),(2); -truncate table t1; -insert into t1 values(1),(2); -select * from t1; -truncate table t1; -insert into t1 values(1),(2); -delete from t1; -select * from t1; -drop table t1; - -# -# Test of how ORDER BY works when doing it on the whole table -# - -create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb; -insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); ---replace_column 9 # -explain select * from t1 order by a; ---replace_column 9 # -explain select * from t1 order by b; ---replace_column 9 # -explain select * from t1 order by c; ---replace_column 9 # -explain select a from t1 order by a; ---replace_column 9 # -explain select b from t1 order by b; ---replace_column 9 # -explain select a,b from t1 order by b; ---replace_column 9 # -explain select a,b from t1; ---replace_column 9 # -explain select a,b,c from t1; -drop table t1; - -# -# Check describe -# - -create table t1 (t int not null default 1, key (t)) engine=innodb; -desc t1; -drop table t1; - -# -# Test of multi-table-delete -# - -CREATE TABLE t1 ( - number bigint(20) NOT NULL default '0', - cname char(15) NOT NULL default '', - carrier_id smallint(6) NOT NULL default '0', - privacy tinyint(4) NOT NULL default '0', - last_mod_date timestamp NOT NULL, - last_mod_id smallint(6) NOT NULL default '0', - last_app_date timestamp NOT NULL, - last_app_id smallint(6) default '-1', - version smallint(6) NOT NULL default '0', - assigned_scps int(11) default '0', - status tinyint(4) default '0' -) ENGINE=InnoDB; -INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1); -INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0); -INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1); -INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0); -INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0); -INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0); -CREATE TABLE t2 ( - number bigint(20) NOT NULL default '0', - cname char(15) NOT NULL default '', - carrier_id smallint(6) NOT NULL default '0', - privacy tinyint(4) NOT NULL default '0', - last_mod_date timestamp NOT NULL, - last_mod_id smallint(6) NOT NULL default '0', - last_app_date timestamp NOT NULL, - last_app_id smallint(6) default '-1', - version smallint(6) NOT NULL default '0', - assigned_scps int(11) default '0', - status tinyint(4) default '0' -) ENGINE=InnoDB; -INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1); -INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0); -INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1); -INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0); -select * from t1; -select * from t2; -delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null); -select * from t1; -select * from t2; -select * from t2; -drop table t1,t2; - -# -# A simple test with some isolation levels -# TODO: Make this into a test using replication to really test how -# this works. -# - -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; - -BEGIN; -SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; -SELECT @@tx_isolation,@@global.tx_isolation; -insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'); -select id, code, name from t1 order by id; -COMMIT; - -BEGIN; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha'); -select id, code, name from t1 order by id; -COMMIT; - -SET binlog_format='MIXED'; -BEGIN; -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt'); -select id, code, name from t1 order by id; -COMMIT; -DROP TABLE t1; - -# -# Test of multi-table-update -# -create table t1 (n int(10), d int(10)) engine=innodb; -create table t2 (n int(10), d int(10)) engine=innodb; -insert into t1 values(1,1),(1,2); -insert into t2 values(1,10),(2,20); -UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; -select * from t1; -select * from t2; -drop table t1,t2; - -# -# Bug #29136 erred multi-delete on trans table does not rollback -# - -# prepare ---disable_warnings -drop table if exists t1, t2; ---enable_warnings -CREATE TABLE t1 (a int, PRIMARY KEY (a)); -CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; -create trigger trg_del_t2 after delete on t2 for each row - insert into t1 values (1); -insert into t1 values (1); -insert into t2 values (1),(2); - - -# exec cases A, B - see multi_update.test - -# A. send_error() w/o send_eof() branch - ---error ER_DUP_ENTRY -delete t2 from t2; - -# check - -select count(*) from t2 /* must be 2 as restored after rollback caused by the error */; - -# cleanup bug#29136 - -drop table t1, t2; - - -# -# Bug #29136 erred multi-delete on trans table does not rollback -# - -# prepare ---disable_warnings -drop table if exists t1, t2; ---enable_warnings -CREATE TABLE t1 (a int, PRIMARY KEY (a)); -CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; -create trigger trg_del_t2 after delete on t2 for each row - insert into t1 values (1); -insert into t1 values (1); -insert into t2 values (1),(2); - - -# exec cases A, B - see multi_update.test - -# A. send_error() w/o send_eof() branch - ---error ER_DUP_ENTRY -delete t2 from t2; - -# check - -select count(*) from t2 /* must be 2 as restored after rollback caused by the error */; - -# cleanup bug#29136 - -drop table t1, t2; - - -# -# Testing of IFNULL -# -create table t1 (a int, b int) engine=innodb; -insert into t1 values(20,null); -select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on -t2.b=t3.a; -select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on -t2.b=t3.a order by 1; -insert into t1 values(10,null); -select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on -t2.b=t3.a order by 1; -drop table t1; - -# -# Test of read_through not existing const_table -# - -create table t1 (a varchar(10) not null) engine=myisam; -create table t2 (b varchar(10) not null unique) engine=innodb; -select t1.a from t1,t2 where t1.a=t2.b; -drop table t1,t2; -create table t1 (a int not null, b int, primary key (a)) engine = innodb; -create table t2 (a int not null, b int, primary key (a)) engine = innodb; -insert into t1 values (10, 20); -insert into t2 values (10, 20); -update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10; -drop table t1,t2; - -# -# Test of multi-table-delete with foreign key constraints -# - -CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; -CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB; -insert into t1 set id=1; -insert into t2 set id=1, t1_id=1; -delete t1,t2 from t1,t2 where t1.id=t2.t1_id; -select * from t1; -select * from t2; -drop table t2,t1; -CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; -CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB; -INSERT INTO t1 VALUES(1); -INSERT INTO t2 VALUES(1, 1); -SELECT * from t1; -UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1; -SELECT * from t1; -UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id; -SELECT * from t1; -DROP TABLE t1,t2; - -# -# Test of range_optimizer -# - -set autocommit=0; - -CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; - -CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; - -CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB; - -INSERT INTO t3 VALUES("my-test-1", "my-test-2"); -COMMIT; - -INSERT INTO t1 VALUES("this-key", "will disappear"); -INSERT INTO t2 VALUES("this-key", "will also disappear"); -DELETE FROM t3 WHERE id1="my-test-1"; - -SELECT * FROM t1; -SELECT * FROM t2; -SELECT * FROM t3; -ROLLBACK; - -SELECT * FROM t1; -SELECT * FROM t2; -SELECT * FROM t3; -SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE; -COMMIT; -set autocommit=1; -DROP TABLE t1,t2,t3; - -# -# Check update with conflicting key -# - -CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb; -INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); -# We need the a < 1000 test here to quard against the halloween problems -UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000; -SELECT * from t1; -drop table t1; - -# -# Test multi update with different join methods -# - -CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb; -CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb; -INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); -INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); - -# Full join, without key -update t1,t2 set t1.a=t1.a+100; -select * from t1; - -# unique key -update t1,t2 set t1.a=t1.a+100 where t1.a=101; -select * from t1; - -# ref key -update t1,t2 set t1.b=t1.b+10 where t1.b=2; -select * from t1; - -# Range key (in t1) -update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100; -select * from t1; -select * from t2; - -drop table t1,t2; -CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; -SET AUTOCOMMIT=0; -INSERT INTO t1 ( B_ID ) VALUES ( 1 ); -INSERT INTO t2 ( NEXT_T ) VALUES ( 1 ); -ROLLBACK; -SELECT * FROM t1; -drop table t1,t2; -create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb; -insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2); -select distinct parent,child from t1 order by parent; -drop table t1; - -# -# Test that MySQL priorities clustered indexes -# -create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb; -create table t2 (a int not null auto_increment primary key, b int); -insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null); -insert into t2 (a) select b from t1; -insert into t1 (b) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -select count(*) from t1; ---replace_column 9 # -explain select * from t1 where c between 1 and 2500; -update t1 set c=a; ---replace_column 9 # -explain select * from t1 where c between 1 and 2500; -drop table t1,t2; - -# -# Test of UPDATE ... ORDER BY -# - -create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb; - -insert into t1 (id) values (null),(null),(null),(null),(null); -update t1 set fk=69 where fk is null order by id limit 1; -SELECT * from t1; -drop table t1; - -create table t1 (a int not null, b int not null, key (a)); -insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3); -SET @tmp=0; -update t1 set b=(@tmp:=@tmp+1) order by a; -update t1 set b=99 where a=1 order by b asc limit 1; -update t1 set b=100 where a=1 order by b desc limit 2; -update t1 set a=a+10+b where a=1 order by b; -select * from t1 order by a,b; -drop table t1; - -# -# Test of multi-table-updates (bug #1980). -# - -create table t1 ( c char(8) not null ) engine=innodb; -insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); -insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); - -alter table t1 add b char(8) not null; -alter table t1 add a char(8) not null; -alter table t1 add primary key (a,b,c); -update t1 set a=c, b=c; - -create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb; -insert into t2 select * from t1; - -delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; -drop table t1,t2; - -# -# test autoincrement with TRUNCATE -# - -SET AUTOCOMMIT=1; -create table t1 (a integer auto_increment primary key) engine=innodb; -insert into t1 (a) values (NULL),(NULL); -truncate table t1; -insert into t1 (a) values (NULL),(NULL); -SELECT * from t1; -drop table t1; - -# -# Test dictionary handling with spaceand quoting -# - -CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB; -CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB; -#show create table t2; -drop table t2,t1; - -# -# Test of multi updated and foreign keys -# - -create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb; -insert into `t1`values ( 1 ) ; -create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb; -insert into `t2`values ( 1 ) ; -create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb; -insert into `t3`values ( 1 ) ; ---error 1451 -delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; ---error 1451 -update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; ---error 1054 -update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; -drop table t3,t2,t1; - -# -# test for recursion depth limit -# -create table t1( - id int primary key, - pid int, - index(pid), - foreign key(pid) references t1(id) on delete cascade) engine=innodb; -insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6), - (8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14); --- error 1451 -delete from t1 where id=0; -delete from t1 where id=15; -delete from t1 where id=0; - -drop table t1; - -# -# Test timestamps -# - -CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB; -CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx -(stamp))ENGINE=InnoDB; -insert into t1 values (1),(2),(3); -# Note that timestamp 3 is wrong -insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000); -SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp < -'20020204120000' GROUP BY col1; -drop table t1,t2; - -# -# Test by Francois MASUREL -# - -CREATE TABLE t1 ( - `id` int(10) unsigned NOT NULL auto_increment, - `id_object` int(10) unsigned default '0', - `id_version` int(10) unsigned NOT NULL default '1', - `label` varchar(100) NOT NULL default '', - `description` text, - PRIMARY KEY (`id`), - KEY `id_object` (`id_object`), - KEY `id_version` (`id_version`) -) ENGINE=InnoDB; - -INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL); - -CREATE TABLE t2 ( - `id` int(10) unsigned NOT NULL auto_increment, - `id_version` int(10) unsigned NOT NULL default '1', - PRIMARY KEY (`id`), - KEY `id_version` (`id_version`) -) ENGINE=InnoDB; - -INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9"); - -SELECT t2.id, t1.`label` FROM t2 INNER JOIN -(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl -ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object); -drop table t1,t2; - -create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam; -create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb; -create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb; -insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, ""); -insert t2 select * from t1; -insert t3 select * from t1; -checksum table t1, t2, t3, t4 quick; -checksum table t1, t2, t3, t4; -checksum table t1, t2, t3, t4 extended; -#show table status; -drop table t1,t2,t3; - -# -# Test problem with refering to different fields in same table in UNION -# (Bug #2552) -# -create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb; -insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt'); -select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1; -drop table t1; - -# -# Bug2160 -# -create table t1 (a int) engine=innodb; -create table t2 like t1; -drop table t1,t2; - -# -# Test of automaticly created foreign keys -# - -create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb; -create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb; -show create table t1; -show create table t2; -create index id on t2 (id); -show create table t2; -create index id2 on t2 (id); -show create table t2; -drop index id2 on t2; ---error 1025,1025 -drop index id on t2; -show create table t2; -drop table t2; - -create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb; -show create table t2; -create unique index id on t2 (id,id2); -show create table t2; -drop table t2; - -# Check foreign key columns created in different order than key columns -create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; -show create table t2; -drop table t2; - -create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb; -show create table t2; -drop table t2; - -create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; -show create table t2; -drop table t2; - -create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb; -show create table t2; -drop table t2; - -create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb; -show create table t2; -alter table t2 add index id_test (id), add index id_test2 (id,id2); -show create table t2; -drop table t2; - -# Test error handling - -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' ---error ER_WRONG_FK_DEF -create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; - -# bug#3749 - -create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb; -show create table t2; -drop table t2; -create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb; -show create table t2; -drop table t2, t1; - - -# -# Bug #6126: Duplicate columns in keys gives misleading error message -# ---error 1060 -create table t1 (c char(10), index (c,c)) engine=innodb; ---error 1060 -create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb; ---error 1060 -create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb; ---error 1060 -create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb; -create table t1 (c1 char(10), c2 char(10)) engine=innodb; ---error 1060 -alter table t1 add key (c1,c1); ---error 1060 -alter table t1 add key (c2,c1,c1); ---error 1060 -alter table t1 add key (c1,c2,c1); ---error 1060 -alter table t1 add key (c1,c1,c2); -drop table t1; - -# -# Bug #4082: integer truncation -# - -create table t1(a int(1) , b int(1)) engine=innodb; -insert into t1 values ('1111', '3333'); -select distinct concat(a, b) from t1; -drop table t1; - -# -# BUG#7709 test case - Boolean fulltext query against unsupported -# engines does not fail -# - -CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; ---error 1214 -SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); -DROP TABLE t1; - -# -# check null values #1 -# - ---disable_warnings -CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1; -INSERT INTO t1 VALUES (1),(2),(3); -CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a), - CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1; ---enable_warnings -INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2); -SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz; -DROP TABLE t2; -DROP TABLE t1; - -# -# Bug#11816 - Truncate table doesn't work with temporary innodb tables -# This is not an innodb bug, but we test it using innodb. -# -create temporary table t1 (a int) engine=innodb; -insert into t1 values (4711); -truncate t1; -insert into t1 values (42); -select * from t1; -drop table t1; -# Show that it works with permanent tables too. -create table t1 (a int) engine=innodb; -insert into t1 values (4711); -truncate t1; -insert into t1 values (42); -select * from t1; -drop table t1; - -# -# Bug #13025 Server crash during filesort -# - -create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=innodb; -insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3); -select * from t1 order by a,b,c,d; -explain select * from t1 order by a,b,c,d; -drop table t1; - -# -# BUG#11039,#13218 Wrong key length in min() -# - -create table t1 (a char(1), b char(1), key(a, b)) engine=innodb; -insert into t1 values ('8', '6'), ('4', '7'); -select min(a) from t1; -select min(b) from t1 where a='8'; -drop table t1; - -# End of 4.1 tests - -# -# range optimizer problem -# - -create table t1 (x bigint unsigned not null primary key) engine=innodb; -insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1); -select * from t1; -select count(*) from t1 where x>0; -select count(*) from t1 where x=0; -select count(*) from t1 where x<0; -select count(*) from t1 where x < -16; -select count(*) from t1 where x = -16; -explain select count(*) from t1 where x > -16; -select count(*) from t1 where x > -16; -select * from t1 where x > -16; -select count(*) from t1 where x = 18446744073709551601; -drop table t1; - - -# Test for testable InnoDB status variables. This test -# uses previous ones(pages_created, rows_deleted, ...). -SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total'; -SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; -SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted'; -SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted'; -SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated'; - -# Test for row locks InnoDB status variables. -SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits'; -SELECT variable_value - @innodb_row_lock_current_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits'; -SELECT variable_value - @innodb_row_lock_time_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time'; -SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max'; -SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'; - -# Test for innodb_sync_spin_loops variable -show variables like "innodb_sync_spin_loops"; -set global innodb_sync_spin_loops=1000; -show variables like "innodb_sync_spin_loops"; -set global innodb_sync_spin_loops=0; -show variables like "innodb_sync_spin_loops"; -set global innodb_sync_spin_loops=20; -show variables like "innodb_sync_spin_loops"; - -# Test for innodb_thread_concurrency variable -SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency; -show variables like "innodb_thread_concurrency"; -set global innodb_thread_concurrency=1001; -show variables like "innodb_thread_concurrency"; -set global innodb_thread_concurrency=0; -show variables like "innodb_thread_concurrency"; -set global innodb_thread_concurrency=16; -show variables like "innodb_thread_concurrency"; -SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency; - -# Test for innodb_concurrency_tickets variable -show variables like "innodb_concurrency_tickets"; -set global innodb_concurrency_tickets=1000; -show variables like "innodb_concurrency_tickets"; -set global innodb_concurrency_tickets=0; -show variables like "innodb_concurrency_tickets"; -set global innodb_concurrency_tickets=500; -show variables like "innodb_concurrency_tickets"; - -# Test for innodb_thread_sleep_delay variable -show variables like "innodb_thread_sleep_delay"; -set global innodb_thread_sleep_delay=100000; -show variables like "innodb_thread_sleep_delay"; -set global innodb_thread_sleep_delay=0; -show variables like "innodb_thread_sleep_delay"; -set global innodb_thread_sleep_delay=10000; -show variables like "innodb_thread_sleep_delay"; - -# -# Test varchar -# - -let $default=`select @@storage_engine`; -set storage_engine=INNODB; -source include/varchar.inc; - -# -# Some errors/warnings on create -# - -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -create table t1 (v varchar(65530), key(v)); -drop table t1; -create table t1 (v varchar(65536)); -show create table t1; -drop table t1; -create table t1 (v varchar(65530) character set utf8); -show create table t1; -drop table t1; - -eval set storage_engine=$default; - -# InnoDB specific varchar tests -create table t1 (v varchar(16384)) engine=innodb; -drop table t1; - -# -# BUG#11039 Wrong key length in min() -# - -create table t1 (a char(1), b char(1), key(a, b)) engine=innodb; -insert into t1 values ('8', '6'), ('4', '7'); -select min(a) from t1; -select min(b) from t1 where a='8'; -drop table t1; - -# -# Bug #11080 & #11005 Multi-row REPLACE fails on a duplicate key error -# - -CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb; -insert into t1 (b) values (1); -replace into t1 (b) values (2), (1), (3); -select * from t1; -truncate table t1; -insert into t1 (b) values (1); -replace into t1 (b) values (2); -replace into t1 (b) values (1); -replace into t1 (b) values (3); -select * from t1; -drop table t1; - -create table t1 (rowid int not null auto_increment, val int not null,primary -key (rowid), unique(val)) engine=innodb; -replace into t1 (val) values ('1'),('2'); -replace into t1 (val) values ('1'),('2'); ---error ER_DUP_ENTRY -insert into t1 (val) values ('1'),('2'); -select * from t1; -drop table t1; - -# -# Test that update does not change internal auto-increment value -# - -create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB; -insert into t1 (val) values (1); -update t1 set a=2 where a=1; -# We should get the following error because InnoDB does not update the counter ---error ER_DUP_ENTRY -insert into t1 (val) values (1); -select * from t1; -drop table t1; -# -# Bug #10465 -# - ---disable_warnings -CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB; ---enable_warnings -INSERT INTO t1 (GRADE) VALUES (151),(252),(343); -SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300; -SELECT GRADE FROM t1 WHERE GRADE= 151; -DROP TABLE t1; - -# -# Bug #12340 multitable delete deletes only one record -# -create table t1 (f1 varchar(10), f2 varchar(10), primary key (f1,f2)) engine=innodb; -create table t2 (f3 varchar(10), f4 varchar(10), key (f4)) engine=innodb; -insert into t2 values ('aa','cc'); -insert into t1 values ('aa','bb'),('aa','cc'); -delete t1 from t1,t2 where f1=f3 and f4='cc'; -select * from t1; -drop table t1,t2; - -# -# Test that the slow TRUNCATE implementation resets autoincrement columns -# (bug #11946) -# - -CREATE TABLE t1 ( -id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) -) ENGINE=InnoDB; - -CREATE TABLE t2 ( -id INTEGER NOT NULL, -FOREIGN KEY (id) REFERENCES t1 (id) -) ENGINE=InnoDB; - -INSERT INTO t1 (id) VALUES (NULL); -SELECT * FROM t1; -TRUNCATE t1; -INSERT INTO t1 (id) VALUES (NULL); -SELECT * FROM t1; - -# continued from above; test that doing a slow TRUNCATE on a table with 0 -# rows resets autoincrement columns -DELETE FROM t1; -TRUNCATE t1; -INSERT INTO t1 (id) VALUES (NULL); -SELECT * FROM t1; -DROP TABLE t2, t1; - -# Test that foreign keys in temporary tables are not accepted (bug #12084) -CREATE TABLE t1 -( - id INT PRIMARY KEY -) ENGINE=InnoDB; - ---error 1005,1005 -CREATE TEMPORARY TABLE t2 -( - id INT NOT NULL PRIMARY KEY, - b INT, - FOREIGN KEY (b) REFERENCES test.t1(id) -) ENGINE=InnoDB; -DROP TABLE t1; - -# -# Test that index column max sizes are honored (bug #13315) -# - -# prefix index -create table t1 (col1 varchar(2000), index (col1(767))) - character set = latin1 engine = innodb; - -# normal indexes -create table t2 (col1 char(255), index (col1)) - character set = latin1 engine = innodb; -create table t3 (col1 binary(255), index (col1)) - character set = latin1 engine = innodb; -create table t4 (col1 varchar(767), index (col1)) - character set = latin1 engine = innodb; -create table t5 (col1 varchar(767) primary key) - character set = latin1 engine = innodb; -create table t6 (col1 varbinary(767) primary key) - character set = latin1 engine = innodb; -create table t7 (col1 text, index(col1(767))) - character set = latin1 engine = innodb; -create table t8 (col1 blob, index(col1(767))) - character set = latin1 engine = innodb; - -# multi-column indexes are allowed to be longer -create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2)) - character set = latin1 engine = innodb; - -show create table t9; - -drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; - -# these should have their index length trimmed -create table t1 (col1 varchar(768), index(col1)) - character set = latin1 engine = innodb; -create table t2 (col1 varbinary(768), index(col1)) - character set = latin1 engine = innodb; -create table t3 (col1 text, index(col1(768))) - character set = latin1 engine = innodb; -create table t4 (col1 blob, index(col1(768))) - character set = latin1 engine = innodb; - -show create table t1; - -drop table t1, t2, t3, t4; - -# these should be refused ---error 1071 -create table t1 (col1 varchar(768) primary key) - character set = latin1 engine = innodb; ---error 1071 -create table t2 (col1 varbinary(768) primary key) - character set = latin1 engine = innodb; ---error 1071 -create table t3 (col1 text, primary key(col1(768))) - character set = latin1 engine = innodb; ---error 1071 -create table t4 (col1 blob, primary key(col1(768))) - character set = latin1 engine = innodb; - -# -# Test improved foreign key error messages (bug #3443) -# - -CREATE TABLE t1 -( - id INT PRIMARY KEY -) ENGINE=InnoDB; - -CREATE TABLE t2 -( - v INT, - CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id) -) ENGINE=InnoDB; - ---error 1452 -INSERT INTO t2 VALUES(2); - -INSERT INTO t1 VALUES(1); -INSERT INTO t2 VALUES(1); - ---error 1451 -DELETE FROM t1 WHERE id = 1; - ---error 1217 -DROP TABLE t1; - -SET FOREIGN_KEY_CHECKS=0; -DROP TABLE t1; -SET FOREIGN_KEY_CHECKS=1; - ---error 1452 -INSERT INTO t2 VALUES(3); - -DROP TABLE t2; -# -# Test that checksum table uses a consistent read Bug #12669 -# -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2); -set autocommit=0; -checksum table t1; -connection b; -insert into t1 values(3); -connection a; -# -# Here checksum should not see insert -# -checksum table t1; -connection a; -commit; -checksum table t1; -commit; -drop table t1; -# -# autocommit = 1 -# -connection a; -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2); -set autocommit=1; -checksum table t1; -connection b; -set autocommit=1; -insert into t1 values(3); -connection a; -# -# Here checksum sees insert -# -checksum table t1; -drop table t1; - -connection default; -disconnect a; -disconnect b; - -# tests for bugs #9802 and #13778 - -# test that FKs between invalid types are not accepted - -set foreign_key_checks=0; -create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' --- error 1005 -create table t1(a char(10) primary key, b varchar(20)) engine = innodb; -set foreign_key_checks=1; -drop table t2; - -# test that FKs between different charsets are not accepted in CREATE even -# when f_k_c is 0 - -set foreign_key_checks=0; -create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' --- error 1005 -create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; -set foreign_key_checks=1; -drop table t1; - -# test that invalid datatype conversions with ALTER are not allowed - -set foreign_key_checks=0; -create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb; -create table t1(a varchar(10) primary key) engine = innodb; --- error 1025,1025 -alter table t1 modify column a int; -set foreign_key_checks=1; -drop table t2,t1; - -# test that charset conversions with ALTER are allowed when f_k_c is 0 - -set foreign_key_checks=0; -create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; -create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; -alter table t1 convert to character set utf8; -set foreign_key_checks=1; -drop table t2,t1; - -# test that RENAME does not allow invalid charsets when f_k_c is 0 - -set foreign_key_checks=0; -create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; -create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLD_DATADIR ./ master-data/ '' --- error 1025 -rename table t3 to t1; -set foreign_key_checks=1; -drop table t2,t3; - -# test that foreign key errors are reported correctly (Bug #15550) - -create table t1(a int primary key) row_format=redundant engine=innodb; -create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=innodb; -create table t3(a int primary key) row_format=compact engine=innodb; -create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=innodb; - -insert into t1 values(1); -insert into t3 values(1); --- error 1452 -insert into t2 values(2); --- error 1452 -insert into t4 values(2); -insert into t2 values(1); -insert into t4 values(1); --- error 1451 -update t1 set a=2; --- error 1452 -update t2 set a=2; --- error 1451 -update t3 set a=2; --- error 1452 -update t4 set a=2; --- error 1451 -truncate t1; --- error 1451 -truncate t3; -truncate t2; -truncate t4; -truncate t1; -truncate t3; - -drop table t4,t3,t2,t1; - - -# -# Test that we can create a large (>1K) key -# -create table t1 (a varchar(255) character set utf8, - b varchar(255) character set utf8, - c varchar(255) character set utf8, - d varchar(255) character set utf8, - key (a,b,c,d)) engine=innodb; -drop table t1; ---error ER_TOO_LONG_KEY -create table t1 (a varchar(255) character set utf8, - b varchar(255) character set utf8, - c varchar(255) character set utf8, - d varchar(255) character set utf8, - e varchar(255) character set utf8, - key (a,b,c,d,e)) engine=innodb; - - -# test the padding of BINARY types and collations (Bug #14189) - -create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb; -create table t2 (s1 binary(2),primary key (s1)) engine=innodb; -create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb; -create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb; - -insert into t1 values (0x41),(0x4120),(0x4100); --- error ER_DUP_ENTRY -insert into t2 values (0x41),(0x4120),(0x4100); -insert into t2 values (0x41),(0x4120); --- error ER_DUP_ENTRY -insert into t3 values (0x41),(0x4120),(0x4100); -insert into t3 values (0x41),(0x4100); --- error ER_DUP_ENTRY -insert into t4 values (0x41),(0x4120),(0x4100); -insert into t4 values (0x41),(0x4100); -select hex(s1) from t1; -select hex(s1) from t2; -select hex(s1) from t3; -select hex(s1) from t4; -drop table t1,t2,t3,t4; - -create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb; -create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb; - -insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42); --- error 1452 -insert into t2 values(0x42); -insert into t2 values(0x41); -select hex(s1) from t2; -update t1 set s1=0x123456 where a=2; -select hex(s1) from t2; --- error 1451 -update t1 set s1=0x12 where a=1; --- error 1451 -update t1 set s1=0x12345678 where a=1; --- error 1451 -update t1 set s1=0x123457 where a=1; -update t1 set s1=0x1220 where a=1; -select hex(s1) from t2; -update t1 set s1=0x1200 where a=1; -select hex(s1) from t2; -update t1 set s1=0x4200 where a=1; -select hex(s1) from t2; --- error 1451 -delete from t1 where a=1; -delete from t1 where a=2; -update t2 set s1=0x4120; --- error 1451 -delete from t1; -delete from t1 where a!=3; -select a,hex(s1) from t1; -select hex(s1) from t2; - -drop table t2,t1; - -create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb; -create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb; - -insert into t1 values(1,0x4100),(2,0x41); -insert into t2 values(0x41); -select hex(s1) from t2; -update t1 set s1=0x1234 where a=1; -select hex(s1) from t2; -update t1 set s1=0x12 where a=2; -select hex(s1) from t2; -delete from t1 where a=1; --- error 1451 -delete from t1 where a=2; -select a,hex(s1) from t1; -select hex(s1) from t2; - -drop table t2,t1; -# Ensure that _ibfk_0 is not mistreated as a -# generated foreign key identifier. (Bug #16387) - -CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB; -CREATE TABLE t2(a INT) ENGINE=InnoDB; -ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a); -ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1; -ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a); -ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0; -SHOW CREATE TABLE t2; -DROP TABLE t2,t1; - -# -# Test case for bug #16229: MySQL/InnoDB uses full explicit table locks in trigger processing -# - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -insert into t1(a) values (1),(2),(3); -commit; -connection b; -set autocommit = 0; -update t1 set b = 5 where a = 2; -connection a; -delimiter |; -create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end | -delimiter ;| -set autocommit = 0; -connection a; -insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100), -(11),(21),(31),(41),(51),(61),(71),(81),(91),(101), -(12),(22),(32),(42),(52),(62),(72),(82),(92),(102), -(13),(23),(33),(43),(53),(63),(73),(83),(93),(103), -(14),(24),(34),(44),(54),(64),(74),(84),(94),(104); -connection b; -commit; -connection a; -commit; -drop trigger t1t; -drop table t1; -disconnect a; -disconnect b; -# -# Another trigger test -# -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -insert into t1(a) values (1),(2),(3); -insert into t2(a) values (1),(2),(3); -insert into t3(a) values (1),(2),(3); -insert into t4(a) values (1),(2),(3); -insert into t3(a) values (5),(7),(8); -insert into t4(a) values (5),(7),(8); -insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12); - -delimiter |; -create trigger t1t before insert on t1 for each row begin - INSERT INTO t2 SET a = NEW.a; -end | - -create trigger t2t before insert on t2 for each row begin - DELETE FROM t3 WHERE a = NEW.a; -end | - -create trigger t3t before delete on t3 for each row begin - UPDATE t4 SET b = b + 1 WHERE a = OLD.a; -end | - -create trigger t4t before update on t4 for each row begin - UPDATE t5 SET b = b + 1 where a = NEW.a; -end | -delimiter ;| -commit; -set autocommit = 0; -update t1 set b = b + 5 where a = 1; -update t2 set b = b + 5 where a = 1; -update t3 set b = b + 5 where a = 1; -update t4 set b = b + 5 where a = 1; -insert into t5(a) values(20); -connection b; -set autocommit = 0; -insert into t1(a) values(7); -insert into t2(a) values(8); -delete from t2 where a = 3; -update t4 set b = b + 1 where a = 3; -commit; -drop trigger t1t; -drop trigger t2t; -drop trigger t3t; -drop trigger t4t; -drop table t1, t2, t3, t4, t5; -connection default; -disconnect a; -disconnect b; - -# -# Test that cascading updates leading to duplicate keys give the correct -# error message (bug #9680) -# - -CREATE TABLE t1 ( - field1 varchar(8) NOT NULL DEFAULT '', - field2 varchar(8) NOT NULL DEFAULT '', - PRIMARY KEY (field1, field2) -) ENGINE=InnoDB; - -CREATE TABLE t2 ( - field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY, - FOREIGN KEY (field1) REFERENCES t1 (field1) - ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB; - -INSERT INTO t1 VALUES ('old', 'somevalu'); -INSERT INTO t1 VALUES ('other', 'anyvalue'); - -INSERT INTO t2 VALUES ('old'); -INSERT INTO t2 VALUES ('other'); - ---error ER_FOREIGN_DUPLICATE_KEY -UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu'; - -DROP TABLE t2; -DROP TABLE t1; - -# -# Bug#18477 - MySQL/InnoDB Ignoring Foreign Keys in ALTER TABLE -# -create table t1 ( - c1 bigint not null, - c2 bigint not null, - primary key (c1), - unique key (c2) -) engine=innodb; -# -create table t2 ( - c1 bigint not null, - primary key (c1) -) engine=innodb; -# -alter table t1 add constraint c2_fk foreign key (c2) - references t2(c1) on delete cascade; -show create table t1; -# -alter table t1 drop foreign key c2_fk; -show create table t1; -# -drop table t1, t2; - -# -# Bug #14360: problem with intervals -# - -create table t1(a date) engine=innodb; -create table t2(a date, key(a)) engine=innodb; -insert into t1 values('2005-10-01'); -insert into t2 values('2005-10-01'); -select * from t1, t2 - where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; -drop table t1, t2; - -create table t1 (id int not null, f_id int not null, f int not null, -primary key(f_id, id)) engine=innodb; -create table t2 (id int not null,s_id int not null,s varchar(200), -primary key(id)) engine=innodb; -INSERT INTO t1 VALUES (8, 1, 3); -INSERT INTO t1 VALUES (1, 2, 1); -INSERT INTO t2 VALUES (1, 0, ''); -INSERT INTO t2 VALUES (8, 1, ''); -commit; -DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id) -WHERE mm.id IS NULL; -select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id) -where mm.id is null lock in share mode; -drop table t1,t2; - -# -# Test case where X-locks on unused rows should be released in a -# update (because READ COMMITTED isolation level) -# - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); -commit; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -update t1 set b = 5 where b = 1; -connection b; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -# -# X-lock to record (7,3) should be released in a update -# -select * from t1 where a = 7 and b = 3 for update; -connection a; -commit; -connection b; -commit; -drop table t1; -connection default; -disconnect a; -disconnect b; - -# -# Test case where no locks should be released (because we are not -# using READ COMMITTED isolation level) -# - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); -commit; -set autocommit = 0; -select * from t1 lock in share mode; -update t1 set b = 5 where b = 1; -connection b; -set autocommit = 0; -# -# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update -# ---error 1205 -select * from t1 where a = 2 and b = 2 for update; -# -# X-lock to record (1,1),(3,1),(5,1) should not be released in a update -# ---error 1205 -connection a; -commit; -connection b; -commit; -connection default; -disconnect a; -disconnect b; -drop table t1; - -# -# Consistent read should be used in following selects -# -# 1) INSERT INTO ... SELECT -# 2) UPDATE ... = ( SELECT ...) -# 3) CREATE ... SELECT - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values (1,2),(5,3),(4,2); -create table t2(d int not null, e int, primary key(d)) engine=innodb; -insert into t2 values (8,6),(12,1),(3,1); -commit; -set autocommit = 0; -select * from t2 for update; -connection b; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -insert into t1 select * from t2; -update t1 set b = (select e from t2 where a = d); -create table t3(d int not null, e int, primary key(d)) engine=innodb -select * from t2; -commit; -connection a; -commit; -connection default; -disconnect a; -disconnect b; -drop table t1, t2, t3; - -# -# Consistent read should not be used if -# -# (a) isolation level is serializable OR -# (b) select ... lock in share mode OR -# (c) select ... for update -# -# in following queries: -# -# 1) INSERT INTO ... SELECT -# 2) UPDATE ... = ( SELECT ...) -# 3) CREATE ... SELECT - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connect (c,localhost,root,,); -connect (d,localhost,root,,); -connect (e,localhost,root,,); -connect (f,localhost,root,,); -connect (g,localhost,root,,); -connect (h,localhost,root,,); -connect (i,localhost,root,,); -connect (j,localhost,root,,); -connection a; -create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values (1,2),(5,3),(4,2); -create table t2(a int not null, b int, primary key(a)) engine=innodb; -insert into t2 values (8,6),(12,1),(3,1); -create table t3(d int not null, b int, primary key(d)) engine=innodb; -insert into t3 values (8,6),(12,1),(3,1); -create table t5(a int not null, b int, primary key(a)) engine=innodb; -insert into t5 values (1,2),(5,3),(4,2); -create table t6(d int not null, e int, primary key(d)) engine=innodb; -insert into t6 values (8,6),(12,1),(3,1); -create table t8(a int not null, b int, primary key(a)) engine=innodb; -insert into t8 values (1,2),(5,3),(4,2); -create table t9(d int not null, e int, primary key(d)) engine=innodb; -insert into t9 values (8,6),(12,1),(3,1); -commit; -set autocommit = 0; -select * from t2 for update; -connection b; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; ---send -insert into t1 select * from t2; -connection c; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; ---send -update t3 set b = (select b from t2 where a = d); -connection d; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; ---send -create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; -connection e; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ---send -insert into t5 (select * from t2 lock in share mode); -connection f; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ---send -update t6 set e = (select b from t2 where a = d lock in share mode); -connection g; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ---send -create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; -connection h; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ---send -insert into t8 (select * from t2 for update); -connection i; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ---send -update t9 set e = (select b from t2 where a = d for update); -connection j; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ---send -create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; - -connection b; ---error 1205 -reap; - -connection c; ---error 1205 -reap; - -connection d; ---error 1205 -reap; - -connection e; ---error 1205 -reap; - -connection f; ---error 1205 -reap; - -connection g; ---error 1205 -reap; - -connection h; ---error 1205 -reap; - -connection i; ---error 1205 -reap; - -connection j; ---error 1205 -reap; - -connection a; -commit; - -connection default; -disconnect a; -disconnect b; -disconnect c; -disconnect d; -disconnect e; -disconnect f; -disconnect g; -disconnect h; -disconnect i; -disconnect j; -drop table t1, t2, t3, t5, t6, t8, t9; - -# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID" ---error 1005 -CREATE TABLE t1 (DB_ROW_ID int) engine=innodb; - -# -# Bug #17152: Wrong result with BINARY comparison on aliased column -# - -CREATE TABLE t1 ( - a BIGINT(20) NOT NULL, - PRIMARY KEY (a) - ) ENGINE=INNODB DEFAULT CHARSET=UTF8; - -CREATE TABLE t2 ( - a BIGINT(20) NOT NULL, - b VARCHAR(128) NOT NULL, - c TEXT NOT NULL, - PRIMARY KEY (a,b), - KEY idx_t2_b_c (b,c(200)), - CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a) - ON DELETE CASCADE - ) ENGINE=INNODB DEFAULT CHARSET=UTF8; - -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1, 'bar', 'vbar'); -INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR'); -INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi'); -INSERT INTO t2 VALUES (1, 'customer_over', '1'); - -SELECT * FROM t2 WHERE b = 'customer_over'; -SELECT * FROM t2 WHERE BINARY b = 'customer_over'; -SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over'; -/* Bang: Empty result set, above was expected: */ -SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; -SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; - -drop table t2, t1; - -# -# Test optimize on table with open transaction -# - -CREATE TABLE t1 ( a int ) ENGINE=innodb; -BEGIN; -INSERT INTO t1 VALUES (1); -OPTIMIZE TABLE t1; -DROP TABLE t1; - -# -# Bug #24741 (existing cascade clauses disappear when adding foreign keys) -# - -CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB; - -CREATE TABLE t2 (id int PRIMARY KEY, f INT NOT NULL, - CONSTRAINT t2_t1 FOREIGN KEY (id) REFERENCES t1 (id) - ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB; - -ALTER TABLE t2 ADD FOREIGN KEY (f) REFERENCES t1 (f) ON -DELETE CASCADE ON UPDATE CASCADE; - -SHOW CREATE TABLE t2; -DROP TABLE t2, t1; - -# -# Bug #25927: Prevent ALTER TABLE ... MODIFY ... NOT NULL on columns -# for which there is a foreign key constraint ON ... SET NULL. -# - -CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB; -CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1); -ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL; -# mysqltest first does replace_regex, then replace_result ---replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLD_DATADIR ./ master-data/ '' ---error 1025 -ALTER TABLE t2 MODIFY a INT NOT NULL; -DELETE FROM t1; -DROP TABLE t2,t1; - -# -# Bug #26835: table corruption after delete+insert -# - -CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY) -ENGINE=InnoDB; -INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4); -DELETE FROM t1; -INSERT INTO t1 VALUES ('DDD'); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Bug #23313 (AUTO_INCREMENT=# not reported back for InnoDB tables) -# Bug #21404 (AUTO_INCREMENT value reset when Adding FKEY (or ALTER?)) -# - -CREATE TABLE t1 (id int PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB -AUTO_INCREMENT=42; - -INSERT INTO t1 VALUES (0),(347),(0); -SELECT * FROM t1; - -SHOW CREATE TABLE t1; - -CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t2 VALUES(42),(347),(348); -ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id); -SHOW CREATE TABLE t1; - -DROP TABLE t1,t2; - -# -# Bug #21101 (Prints wrong error message if max row size is too large) -# ---error 1118 -CREATE TABLE t1 ( - c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255), - c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255), - c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), - c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), - c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), - c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), - c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), - c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255) - ) ENGINE = InnoDB; - -# -# Bug #31860 InnoDB assumes AUTOINC values can only be positive. -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1( - id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY - ) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-10); -SELECT * FROM t1; -# -# NOTE: The server really needs to be restarted at this point -# for the test to be useful. -# -# Without the fix InnoDB would trip over an assertion here. -INSERT INTO t1 VALUES(NULL); -# The next value should be 1 and not -9 or a -ve number -SELECT * FROM t1; -DROP TABLE t1; - -# -# Bug #21409 Incorrect result returned when in READ-COMMITTED with -# query_cache ON -# -CONNECT (c1,localhost,root,,); -CONNECT (c2,localhost,root,,); -CONNECTION c1; -SET binlog_format='MIXED'; -SET TX_ISOLATION='read-committed'; -SET AUTOCOMMIT=0; -DROP TABLE IF EXISTS t1, t2; -CREATE TABLE t1 ( a int ) ENGINE=InnoDB; -CREATE TABLE t2 LIKE t1; -SELECT * FROM t2; -CONNECTION c2; -SET binlog_format='MIXED'; -SET TX_ISOLATION='read-committed'; -SET AUTOCOMMIT=0; -INSERT INTO t1 VALUES (1); -COMMIT; -CONNECTION c1; -SELECT * FROM t1 WHERE a=1; -DISCONNECT c1; -DISCONNECT c2; -CONNECT (c1,localhost,root,,); -CONNECT (c2,localhost,root,,); -CONNECTION c1; -SET binlog_format='MIXED'; -SET TX_ISOLATION='read-committed'; -SET AUTOCOMMIT=0; -SELECT * FROM t2; -CONNECTION c2; -SET binlog_format='MIXED'; -SET TX_ISOLATION='read-committed'; -SET AUTOCOMMIT=0; -INSERT INTO t1 VALUES (2); -COMMIT; -CONNECTION c1; -# The result set below should be the same for both selects -SELECT * FROM t1 WHERE a=2; -SELECT * FROM t1 WHERE a=2; -DROP TABLE t1; -DROP TABLE t2; -DISCONNECT c1; -DISCONNECT c2; -CONNECTION default; - -# -# Bug #29157 UPDATE, changed rows incorrect -# -create table t1 (i int, j int) engine=innodb; -insert into t1 (i, j) values (1, 1), (2, 2); ---enable_info -update t1 set j = 2; ---disable_info -drop table t1; - -# -# Bug #32440 InnoDB free space info does not appear in SHOW TABLE STATUS or -# I_S -# -create table t1 (id int) comment='this is a comment' engine=innodb; -select table_comment, data_free > 0 as data_free_is_set - from information_schema.tables - where table_schema='test' and table_name = 't1'; -drop table t1; - -# -# Bug 34920 test -# -CONNECTION default; -CREATE TABLE t1 ( - c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, - c2 VARCHAR(128) NOT NULL, - PRIMARY KEY(c1) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=100; - -CREATE TABLE t2 ( - c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, - c2 INT(10) UNSIGNED DEFAULT NULL, - PRIMARY KEY(c1) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=200; - -SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; -ALTER TABLE t2 ADD CONSTRAINT t1_t2_1 FOREIGN KEY(c1) REFERENCES t1(c1); -SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; -DROP TABLE t2; -DROP TABLE t1; -# End 34920 test -# -# Bug #29507 TRUNCATE shows to many rows effected -# -CONNECTION default; -CREATE TABLE t1 (c1 int default NULL, - c2 int default NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - ---enable_info -TRUNCATE TABLE t1; - -INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); -TRUNCATE TABLE t1; - ---disable_info -DROP TABLE t1; -# -# Bug#35537 Innodb doesn't increment handler_update and handler_delete. -# --- disable_query_log --- disable_result_log - -CONNECT (c1,localhost,root,,); - -DROP TABLE IF EXISTS bug35537; -CREATE TABLE bug35537 ( - c1 int -) ENGINE=InnoDB; - -INSERT INTO bug35537 VALUES (1); - --- enable_result_log - -SHOW SESSION STATUS LIKE 'Handler_update%'; -SHOW SESSION STATUS LIKE 'Handler_delete%'; - -UPDATE bug35537 SET c1 = 2 WHERE c1 = 1; -DELETE FROM bug35537 WHERE c1 = 2; - -SHOW SESSION STATUS LIKE 'Handler_update%'; -SHOW SESSION STATUS LIKE 'Handler_delete%'; - -DROP TABLE bug35537; - -DISCONNECT c1; -CONNECTION default; - -SET GLOBAL innodb_thread_concurrency = @innodb_thread_concurrency_orig; - -####################################################################### -# # -# Please, DO NOT TOUCH this file as well as the innodb.result file. # -# These files are to be modified ONLY BY INNOBASE guys. # -# # -# Use innodb_mysql.[test|result] files instead. # -# # -# If nevertheless you need to make some changes here, please, forward # -# your commit message # -# To: innodb_dev_ww@oracle.com # -# Cc: dev-innodb@mysql.com # -# (otherwise your changes may be erased). # -# # -####################################################################### diff --git a/mysql-test/t/innodb_bug21704.test b/mysql-test/t/innodb_bug21704.test deleted file mode 100644 index c649b61034c..00000000000 --- a/mysql-test/t/innodb_bug21704.test +++ /dev/null @@ -1,96 +0,0 @@ --- source include/have_innodb.inc - ---echo # ---echo # Bug#21704: Renaming column does not update FK definition. ---echo # - ---echo ---echo # Test that it's not possible to rename columns participating in a ---echo # foreign key (either in the referencing or referenced table). ---echo - ---disable_warnings -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -DROP TABLE IF EXISTS t3; ---enable_warnings - -CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB; - -CREATE TABLE t2 (a INT PRIMARY KEY, b INT, - CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a)) -ROW_FORMAT=COMPACT ENGINE=INNODB; - -CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT, - CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a)) -ROW_FORMAT=COMPACT ENGINE=INNODB; - -INSERT INTO t1 VALUES (1,1),(2,2),(3,3); -INSERT INTO t2 VALUES (1,1),(2,2),(3,3); -INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3); - ---echo ---echo # Test renaming the column in the referenced table. ---echo - -# mysqltest first does replace_regex, then replace_result ---replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' ---error ER_ERROR_ON_RENAME -ALTER TABLE t1 CHANGE a c INT; - ---echo # Ensure that online column rename works. - ---enable_info -ALTER TABLE t1 CHANGE b c INT; ---disable_info - ---echo ---echo # Test renaming the column in the referencing table ---echo - -# mysqltest first does replace_regex, then replace_result ---replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' ---error ER_ERROR_ON_RENAME -ALTER TABLE t2 CHANGE a c INT; - ---echo # Ensure that online column rename works. - ---enable_info -ALTER TABLE t2 CHANGE b c INT; ---disable_info - ---echo ---echo # Test with self-referential constraints ---echo - -# mysqltest first does replace_regex, then replace_result ---replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' ---error ER_ERROR_ON_RENAME -ALTER TABLE t3 CHANGE a d INT; - -# mysqltest first does replace_regex, then replace_result ---replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' ---error ER_ERROR_ON_RENAME -ALTER TABLE t3 CHANGE b d INT; - ---echo # Ensure that online column rename works. - ---enable_info -ALTER TABLE t3 CHANGE c d INT; ---disable_info - ---echo ---echo # Cleanup. ---echo - -DROP TABLE t3; -DROP TABLE t2; -DROP TABLE t1; diff --git a/mysql-test/t/innodb_bug34053.test b/mysql-test/t/innodb_bug34053.test deleted file mode 100644 index b935e45c06d..00000000000 --- a/mysql-test/t/innodb_bug34053.test +++ /dev/null @@ -1,50 +0,0 @@ -# -# Make sure http://bugs.mysql.com/34053 remains fixed. -# - --- source include/not_embedded.inc --- source include/have_innodb.inc - -SET storage_engine=InnoDB; - -# we do not really care about what gets printed, we are only -# interested in getting success or failure according to our -# expectations --- disable_query_log --- disable_result_log - -GRANT USAGE ON *.* TO 'shane'@'localhost' IDENTIFIED BY '12345'; -FLUSH PRIVILEGES; - --- connect (con1,localhost,shane,12345,) - --- connection con1 --- error ER_SPECIFIC_ACCESS_DENIED_ERROR -CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB; --- error ER_SPECIFIC_ACCESS_DENIED_ERROR -CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB; -CREATE TABLE innodb_monitorx (a INT) ENGINE=INNODB; -DROP TABLE innodb_monitorx; -CREATE TABLE innodb_monito (a INT) ENGINE=INNODB; -DROP TABLE innodb_monito; -CREATE TABLE xinnodb_monitor (a INT) ENGINE=INNODB; -DROP TABLE xinnodb_monitor; -CREATE TABLE nnodb_monitor (a INT) ENGINE=INNODB; -DROP TABLE nnodb_monitor; - --- connection default -CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB; -CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB; - --- connection con1 --- error ER_SPECIFIC_ACCESS_DENIED_ERROR -DROP TABLE innodb_monitor; --- error ER_SPECIFIC_ACCESS_DENIED_ERROR -DROP TABLE innodb_mem_validate; - --- connection default -DROP TABLE innodb_monitor; -DROP TABLE innodb_mem_validate; -DROP USER 'shane'@'localhost'; - --- disconnect con1 diff --git a/mysql-test/t/innodb_bug34300.test b/mysql-test/t/innodb_bug34300.test deleted file mode 100644 index 432ddd03547..00000000000 --- a/mysql-test/t/innodb_bug34300.test +++ /dev/null @@ -1,37 +0,0 @@ -# -# Bug#34300 Tinyblob & tinytext fields currupted after export/import and alter in 5.1 -# http://bugs.mysql.com/34300 -# - --- source include/have_innodb.inc - --- disable_query_log --- disable_result_log - -# set packet size and reconnect -SET @@global.max_allowed_packet=16777216; ---connect (newconn, localhost, root,,) - -DROP TABLE IF EXISTS bug34300; -CREATE TABLE bug34300 ( - f4 TINYTEXT, - f6 MEDIUMTEXT, - f8 TINYBLOB -) ENGINE=InnoDB; - -INSERT INTO bug34300 VALUES ('xxx', repeat('a', 8459264), 'zzz'); - --- enable_query_log --- enable_result_log - -SELECT f4, f8 FROM bug34300; - -ALTER TABLE bug34300 ADD COLUMN (f10 INT); - -SELECT f4, f8 FROM bug34300; - -DROP TABLE bug34300; - -disconnect newconn; -connection default; -SET @@global.max_allowed_packet=default; diff --git a/mysql-test/t/innodb_bug35220.test b/mysql-test/t/innodb_bug35220.test deleted file mode 100644 index 26f7d6b1ddd..00000000000 --- a/mysql-test/t/innodb_bug35220.test +++ /dev/null @@ -1,16 +0,0 @@ -# -# Bug#35220 ALTER TABLE too picky on reserved word "foreign" -# http://bugs.mysql.com/35220 -# - --- source include/have_innodb.inc - -SET storage_engine=InnoDB; - -# we care only that the following SQL commands do not produce errors --- disable_query_log --- disable_result_log - -CREATE TABLE bug35220 (foreign_col INT, dummy_cant_delete_all_columns INT); -ALTER TABLE bug35220 DROP foreign_col; -DROP TABLE bug35220; diff --git a/mysql-test/t/innodb_bug38231.test b/mysql-test/t/innodb_bug38231.test deleted file mode 100644 index 1611cb56203..00000000000 --- a/mysql-test/t/innodb_bug38231.test +++ /dev/null @@ -1,112 +0,0 @@ -# -# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK -# http://bugs.mysql.com/38231 -# - --- source include/have_innodb.inc - -SET storage_engine=InnoDB; - -# we care only that the following SQL commands do not crash the server --- disable_query_log --- disable_result_log - -DROP TABLE IF EXISTS bug38231; -CREATE TABLE bug38231 (a INT); - --- connect (con1,localhost,root,,) --- connect (con2,localhost,root,,) --- connect (con3,localhost,root,,) - --- connection con1 -SET autocommit=0; -LOCK TABLE bug38231 WRITE; - --- connection con2 -SET autocommit=0; --- send -LOCK TABLE bug38231 WRITE; - -# When con1 does UNLOCK below this will release either con2 or con3 which are -# both waiting on LOCK. At the end we must first --reap and UNLOCK the -# connection that has been released, otherwise it will wait forever. We assume -# that the released connection will be the first one that has gained the LOCK, -# thus we force the order here - con2 does LOCK first, then con3. In other -# words we wait for LOCK from con2 above to be exected before doing LOCK in -# con3. --- connection con1 -let $wait_condition = - SELECT COUNT(*) = 1 FROM information_schema.processlist - WHERE info = 'LOCK TABLE bug38231 WRITE'; --- source include/wait_condition.inc -# the above enables query log, re-disable it --- disable_query_log - --- connection con3 -SET autocommit=0; --- send -LOCK TABLE bug38231 WRITE; - --- connection default --- send -TRUNCATE TABLE bug38231; - --- connection con1 -# Wait for TRUNCATE and the other two LOCKs to be executed; without this, -# sometimes UNLOCK executes before them. We assume there are no other -# sessions executing at the same time with the same SQL commands. -let $wait_condition = - SELECT COUNT(*) = 1 FROM information_schema.processlist - WHERE info = 'TRUNCATE TABLE bug38231'; --- source include/wait_condition.inc -let $wait_condition = - SELECT COUNT(*) = 2 FROM information_schema.processlist - WHERE info = 'LOCK TABLE bug38231 WRITE'; --- source include/wait_condition.inc -# the above enables query log, re-disable it --- disable_query_log - -# this crashes the server if the bug is present -UNLOCK TABLES; - -# clean up - --- connection con2 --- reap -UNLOCK TABLES; - --- connection con3 --- reap -UNLOCK TABLES; - --- connection default --- reap - --- disconnect con1 --- disconnect con2 --- disconnect con3 - -# test that TRUNCATE works with with row-level locks - --- enable_query_log --- enable_result_log - -INSERT INTO bug38231 VALUES (1), (10), (300); - --- connect (con4,localhost,root,,) - --- connection con4 -SET autocommit=0; -SELECT * FROM bug38231 FOR UPDATE; - --- connection default -TRUNCATE TABLE bug38231; - --- connection con4 -COMMIT; - --- connection default - --- disconnect con4 - -DROP TABLE bug38231; diff --git a/mysql-test/t/innodb_bug39438-master.opt b/mysql-test/t/innodb_bug39438-master.opt deleted file mode 100644 index 43fac202fd4..00000000000 --- a/mysql-test/t/innodb_bug39438-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb-file-per-table=1 diff --git a/mysql-test/t/innodb_bug39438.test b/mysql-test/t/innodb_bug39438.test deleted file mode 100644 index 2a51e5fcbb8..00000000000 --- a/mysql-test/t/innodb_bug39438.test +++ /dev/null @@ -1,31 +0,0 @@ -# -# Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch -# http://bugs.mysql.com/39438 -# -# This test must be run with innodb_file_per_table=1 because the crash -# only occurs if that option is turned on and DISCARD TABLESPACE only -# works with innodb_file_per_table. -# - --- source include/have_innodb.inc - ---disable_query_log -call mtr.add_suppression("InnoDB: Error: table 'test/bug39438'"); ---enable_query_log - -SET storage_engine=InnoDB; - -# we care only that the following SQL commands do not crash the server --- disable_query_log --- disable_result_log - -DROP TABLE IF EXISTS bug39438; - -CREATE TABLE bug39438 (id INT) ENGINE=INNODB; - -ALTER TABLE bug39438 DISCARD TABLESPACE; - -# this crashes the server if the bug is present -SHOW TABLE STATUS; - -DROP TABLE bug39438; diff --git a/mysql-test/t/innodb_bug40565.test b/mysql-test/t/innodb_bug40565.test deleted file mode 100644 index d7aa0fd514a..00000000000 --- a/mysql-test/t/innodb_bug40565.test +++ /dev/null @@ -1,10 +0,0 @@ -# Bug #40565 Update Query Results in "1 Row Affected" But Should Be "Zero Rows" --- source include/have_innodb.inc - -create table bug40565(value decimal(4,2)) engine=innodb; -insert into bug40565 values (1), (null); ---enable_info -update bug40565 set value=NULL; -update bug40565 set value=NULL; ---disable_info -drop table bug40565; diff --git a/mysql-test/t/innodb_bug42101-nonzero-master.opt b/mysql-test/t/innodb_bug42101-nonzero-master.opt deleted file mode 100644 index d71dbe17d5b..00000000000 --- a/mysql-test/t/innodb_bug42101-nonzero-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_commit_concurrency=1 diff --git a/mysql-test/t/innodb_bug42101-nonzero.test b/mysql-test/t/innodb_bug42101-nonzero.test deleted file mode 100644 index 685fdf20489..00000000000 --- a/mysql-test/t/innodb_bug42101-nonzero.test +++ /dev/null @@ -1,21 +0,0 @@ -# -# Bug#42101 Race condition in innodb_commit_concurrency -# http://bugs.mysql.com/42101 -# - --- source include/have_innodb.inc - ---error ER_WRONG_ARGUMENTS -set global innodb_commit_concurrency=0; -select @@innodb_commit_concurrency; -set global innodb_commit_concurrency=1; -select @@innodb_commit_concurrency; -set global innodb_commit_concurrency=42; -select @@innodb_commit_concurrency; -set global innodb_commit_concurrency=DEFAULT; -select @@innodb_commit_concurrency; ---error ER_WRONG_ARGUMENTS -set global innodb_commit_concurrency=0; -select @@innodb_commit_concurrency; -set global innodb_commit_concurrency=1; -select @@innodb_commit_concurrency; diff --git a/mysql-test/t/innodb_bug42101.test b/mysql-test/t/innodb_bug42101.test deleted file mode 100644 index b6536490d48..00000000000 --- a/mysql-test/t/innodb_bug42101.test +++ /dev/null @@ -1,19 +0,0 @@ -# -# Bug#42101 Race condition in innodb_commit_concurrency -# http://bugs.mysql.com/42101 -# - --- source include/have_innodb.inc - -set global innodb_commit_concurrency=0; -select @@innodb_commit_concurrency; ---error ER_WRONG_ARGUMENTS -set global innodb_commit_concurrency=1; -select @@innodb_commit_concurrency; ---error ER_WRONG_ARGUMENTS -set global innodb_commit_concurrency=42; -select @@innodb_commit_concurrency; -set global innodb_commit_concurrency=0; -select @@innodb_commit_concurrency; -set global innodb_commit_concurrency=DEFAULT; -select @@innodb_commit_concurrency; diff --git a/mysql-test/t/innodb_bug44369.test b/mysql-test/t/innodb_bug44369.test deleted file mode 100644 index 238dc3d8fb1..00000000000 --- a/mysql-test/t/innodb_bug44369.test +++ /dev/null @@ -1,21 +0,0 @@ -# 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; - -show warnings; - ---error ER_CANT_CREATE_TABLE -create table bug44369 (db_TRX_Id int) engine=innodb; - -show warnings; diff --git a/mysql-test/t/innodb_bug45357.test b/mysql-test/t/innodb_bug45357.test deleted file mode 100644 index 81727f352dd..00000000000 --- a/mysql-test/t/innodb_bug45357.test +++ /dev/null @@ -1,10 +0,0 @@ --- source include/have_innodb.inc - -set session transaction isolation level read committed; - -create table bug45357(a int, b int,key(b))engine=innodb; -insert into bug45357 values (25170,6122); -update bug45357 set a=1 where b=30131; -delete from bug45357 where b < 20996; -delete from bug45357 where b < 7001; -drop table bug45357; diff --git a/mysql-test/t/innodb_bug46000.test b/mysql-test/t/innodb_bug46000.test deleted file mode 100644 index eb10d866e54..00000000000 --- a/mysql-test/t/innodb_bug46000.test +++ /dev/null @@ -1,34 +0,0 @@ -# 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 warnings; - -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 warnings; - -# 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; diff --git a/mysql-test/t/innodb_bug47621.test b/mysql-test/t/innodb_bug47621.test deleted file mode 100644 index 4863cc6bba1..00000000000 --- a/mysql-test/t/innodb_bug47621.test +++ /dev/null @@ -1,57 +0,0 @@ -# This is the test for bug #47621, column rename operation should -# not result in column definition inconsistency between MySQL and -# InnoDB - ---source include/have_innodb.inc - -CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB; - -# Change the column name -ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT; - -# If there is inconsistency of column name definition -# in MySQL or InnoDB, following create index would fail -create index orgs on bug47621(sales_acct_id); - -# Change the column name back with the index defined on it. -ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT; - -drop table bug47621; - -CREATE TABLE bug47621_sale ( - salesperson INT, - PRIMARY KEY(salesperson)) engine = innodb; - -CREATE TABLE bug47621_shirt( - id SMALLINT, - owner INT, - FOREIGN KEY(owner) - references bug47621_sale(salesperson) ON DELETE RESTRICT) - engine = innodb; - -insert into bug47621_sale values(9); - -insert into bug47621_shirt values(1, 9); - -# Any rename operation on columns involved in a reference constraint will -# fail, as it will be rejected by InnoDB row_rename_table_for_mysql(). -# In above example, any rename on column "salesperson" for table -# "bug47621_sale", or on column "owner" for table "bug47621_shirt will -# be blocked. We do not put such rename in the test since InnoDB error -# message will be printed in the error log, and result in test failure. -# -# ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT; - -# Any rename on columns not involved in the foreign key constraint -# could still proceed -ALTER TABLE bug47621_shirt CHANGE id new_id INT; - -# Referencing table dropped, the rename operation on related columns -# could proceed -drop table bug47621_shirt; - -ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT; - -ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id); - -drop table bug47621_sale; diff --git a/mysql-test/t/innodb_bug47777.test b/mysql-test/t/innodb_bug47777.test deleted file mode 100644 index 8f2985b2cf0..00000000000 --- a/mysql-test/t/innodb_bug47777.test +++ /dev/null @@ -1,24 +0,0 @@ -# This is the test for bug 47777. GEOMETRY -# data is treated as BLOB data in innodb. -# Consequently, its key value generation/storing -# should follow the process for the BLOB -# datatype as well. - ---source include/have_innodb.inc - -create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb; - -insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)')); - -# Verify correct row get inserted. -select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'); - -# Update table bug47777 should be successful. -update bug47777 set c2=GeomFromText('POINT(1 1)'); - -# Verify the row get updated successfully. The original -# c2 value should be changed to GeomFromText('POINT(1 1)'). -select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'); -select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)'); - -drop table bug47777; diff --git a/mysql-test/t/innodb_bug51920.test b/mysql-test/t/innodb_bug51920.test deleted file mode 100644 index 05c884134be..00000000000 --- a/mysql-test/t/innodb_bug51920.test +++ /dev/null @@ -1,39 +0,0 @@ -# -# Bug #51920: InnoDB connections in lock wait ignore KILL until timeout -# --- source include/not_embedded.inc --- source include/have_innodb.inc - -CREATE TABLE bug51920 (i INT) ENGINE=InnoDB; -INSERT INTO bug51920 VALUES (1); - -BEGIN; -SELECT * FROM bug51920 FOR UPDATE; - -connect (con1,localhost,root,,); - -connection con1; ---send -UPDATE bug51920 SET i=2; - -connection default; -let $wait_condition = - SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE INFO="UPDATE bug51920 SET i=2"; --- source include/wait_condition.inc - -SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST -WHERE INFO="UPDATE bug51920 SET i=2" -INTO @thread_id; - -KILL @thread_id; -let $wait_condition = - SELECT COUNT(*)=0 FROM information_schema.processlist WHERE ID=@thread_id; --- source include/wait_condition.inc - -connection con1; --- error ER_QUERY_INTERRUPTED -reap; -connection default; -DROP TABLE bug51920; --- disconnect con1 diff --git a/mysql-test/t/innodb_trx_weight.test b/mysql-test/t/innodb_trx_weight.test deleted file mode 100644 index b72eaad345f..00000000000 --- a/mysql-test/t/innodb_trx_weight.test +++ /dev/null @@ -1,108 +0,0 @@ -# -# Ensure that the number of locks (SELECT FOR UPDATE for example) is -# added to the number of altered rows when choosing the smallest -# transaction to kill as a victim when a deadlock is detected. -# Also transactions what had edited non-transactional tables should -# be heavier than ones that had not. -# - --- source include/have_innodb.inc - -SET storage_engine=InnoDB; - -# we do not really care about what gets printed, we are only -# interested in getting the deadlock resolved according to our -# expectations --- disable_query_log --- disable_result_log - -# we want to use "-- eval statement1; statement2" which does not work with -# prepared statements. Because this test should not behave differently with -# or without prepared statements we disable them so the test does not fail -# if someone runs ./mysql-test-run.pl --ps-protocol --- disable_ps_protocol - --- disable_warnings -DROP TABLE IF EXISTS t1, t2, t3, t4, t5_nontrans; --- enable_warnings - -# we will create a simple deadlock with t1, t2 and two connections -CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a INT); - -# auxiliary table with a bulk of rows which will be locked by a -# transaction to increase its weight -CREATE TABLE t3 (a INT); - -# auxiliary empty table which will be inserted by a -# transaction to increase its weight -CREATE TABLE t4 (a INT); - -# auxiliary non-transactional table which will be edited by a -# transaction to tremendously increase its weight -CREATE TABLE t5_nontrans (a INT) ENGINE=MyISAM; - -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1); -# insert a lot of rows in t3 -INSERT INTO t3 VALUES (1); -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; - -# test locking weight - --- let $con1_extra_sql = --- let $con1_extra_sql_present = 0 --- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE --- let $con2_extra_sql_present = 1 --- let $con1_should_be_rolledback = 1 --- source include/innodb_trx_weight.inc - --- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1) --- let $con1_extra_sql_present = 1 --- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE --- let $con2_extra_sql_present = 1 --- let $con1_should_be_rolledback = 1 --- source include/innodb_trx_weight.inc - --- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1), (1), (1), (1) --- let $con1_extra_sql_present = 1 --- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE --- let $con2_extra_sql_present = 1 --- let $con1_should_be_rolledback = 0 --- source include/innodb_trx_weight.inc - -# test weight when non-transactional tables are edited - --- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1) --- let $con1_extra_sql_present = 1 --- let $con2_extra_sql = --- let $con2_extra_sql_present = 0 --- let $con1_should_be_rolledback = 0 --- source include/innodb_trx_weight.inc - --- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1) --- let $con1_extra_sql_present = 1 --- let $con2_extra_sql = INSERT INTO t5_nontrans VALUES (1) --- let $con2_extra_sql_present = 1 --- let $con1_should_be_rolledback = 1 --- source include/innodb_trx_weight.inc - --- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1) --- let $con1_extra_sql = $con1_extra_sql; INSERT INTO t5_nontrans VALUES (1) --- let $con1_extra_sql_present = 1 --- let $con2_extra_sql = INSERT INTO t5_nontrans VALUES (1) --- let $con2_extra_sql_present = 1 --- let $con1_should_be_rolledback = 0 --- source include/innodb_trx_weight.inc - -DROP TABLE t1, t2, t3, t4, t5_nontrans; -- cgit v1.2.1 From 9a7da960f81b074ff14037592b5741c59e2e5316 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 12 Apr 2010 17:26:20 +0300 Subject: Fix path to have_innodb_plugin.inc --- mysql-test/t/partition_innodb_plugin.test | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test index fed8c96424a..eeb990c0d81 100644 --- a/mysql-test/t/partition_innodb_plugin.test +++ b/mysql-test/t/partition_innodb_plugin.test @@ -1,6 +1,5 @@ --source include/have_partition.inc ---source include/have_innodb.inc ---source suite/innodb/include/have_innodb_plugin.inc +--source include/have_innodb_plugin.inc # # Bug#32430 - show engine innodb status causes errors -- cgit v1.2.1 From 6d43510a421cd450d8c43224f38a17b4a59ec556 Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Tue, 27 Apr 2010 00:06:00 +0400 Subject: Backport of the fix for bug #50335 to 5.0. The problem was in an incorrect debug assertion. The expression used in the failing assertion states that when finding references matching ORDER BY expressions, there can be only one reference to a single table. But that does not make any sense, all test cases for this bug are valid examples with multiple identical WHERE expressions referencing the same table which are also present in the ORDER BY list. Fixed by removing the failing assertion. We also have to take care of the 'found' counter so that we count multiple references only once. We rely on this fact later in eq_ref_table(). mysql-test/r/join.result: Added a test case for bug #50335. mysql-test/t/join.test: Added a test case for bug #50335. sql/sql_select.cc: Removing the assertion in eq_ref_table() as it does not make any sense. We also have to take care of the 'found' counter so that we count multiple references only once. We rely on this fact later in eq_ref_table(). --- mysql-test/t/join.test | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index a9900c34f1e..d51740bb380 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -736,4 +736,15 @@ WHERE ROW(t1.a, 1111.11) = ROW(1111.11, 1111.11) AND ROW(t1.b, 1111.11) <=> ROW('',''); DROP TABLE t1; +--echo # +--echo # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table +--echo # + +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b)); +INSERT INTO t1 VALUES (0,0), (1,1); + +SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a; + +DROP TABLE t1; + --echo End of 5.0 tests. -- cgit v1.2.1 From 3bffc40a247252def07e1e2b1b0091d2dd04faae Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Fri, 30 Apr 2010 13:02:36 +0300 Subject: Disable innodb.innodb, main.ps_3innodb and main.partition_innodb_plugin mysql-tests because those emit (spurious?) valgrind warnings. --- mysql-test/t/disabled.def | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 07462e91696..68584c6f3e3 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,3 +11,5 @@ ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically +partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings +ps_3innodb : Bug#53309 2010-04-30 VasilDimov valgrind warnings -- cgit v1.2.1 From b58cb7c4a283ea9775d55d1d133cec9359f86dfa Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 30 Apr 2010 12:12:25 +0200 Subject: small changes to WL#43: consistency: don't use "index" and "key" interchangeably => rename "key" to "index" consistency: all option types are logical, besides ULL => rename ULL to NUMBER don't accept floats where integers are expected accept hexadecimal where integers are expected --- mysql-test/t/plugin.test | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index a7f3c693389..f57fedaa32d 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -110,6 +110,17 @@ drop table t1; SET SQL_MODE=''; --error ER_BAD_OPTION_VALUE CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS; + +--error ER_PARSE_ERROR +CREATE TABLE t1 (a int) ENGINE=example ULL=10.00; + +--error ER_PARSE_ERROR +CREATE TABLE t1 (a int) ENGINE=example ULL=1e2; + +CREATE TABLE t1 (a int) ENGINE=example ULL=0x1234; +SHOW CREATE TABLE t1; +DROP TABLE t1; + SET @@SQL_MODE=@OLD_SQL_MODE; # -- cgit v1.2.1 From 97374a11849f3b61ed431c1abe75a283d765e859 Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Fri, 30 Apr 2010 15:10:48 +0400 Subject: Bug #48419: another explain crash.. WHERE predicates containing references to empty tables in a subquery were handled incorrectly by the optimizer when executing EXPLAIN. As a result, the optimizer could try to evaluate such predicates rather than just stop with "Impossible WHERE noticed after reading const tables" as it would do in a non-subquery case. This led to valgrind errors and crashes. Fixed the code checking the above condition so that subqueries are not excluded and hence are handled in the same way as top level SELECTs. mysql-test/r/explain.result: Added a test case for bug #48419. mysql-test/r/ps.result: Updated test results to take the new (and more correct) "Extra" comments in execution plans. mysql-test/t/explain.test: Added a test case for bug #48419. sql/sql_select.cc: There is no point in excluding subqueries from checking for identically false WHERE conditions. --- mysql-test/t/explain.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test index 3c2f7bbbe96..ba6be72dbdc 100644 --- a/mysql-test/t/explain.test +++ b/mysql-test/t/explain.test @@ -198,4 +198,19 @@ INSERT INTO t2 VALUES (NULL), (0); EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) FROM t1; DROP TABLE t1, t2; + +--echo # +--echo # Bug #48419: another explain crash.. +--echo # + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b BLOB, KEY b(b(100))); +INSERT INTO t2 VALUES ('1'), ('2'), ('3'); + +FLUSH TABLES; + +EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND t.a); + +DROP TABLE t1, t2; + --echo End of 5.1 tests. -- cgit v1.2.1 From 2b8de050bfc98f0a0774d6a54be05ee774d2fa46 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 30 Apr 2010 22:04:35 +0200 Subject: create table options bug: alter table does not reset HA_OPTION_TEXT_CREATE_OPTIONS when the last option value is removed --- mysql-test/t/plugin.test | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index f57fedaa32d..3bbe615ebe6 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -119,6 +119,10 @@ CREATE TABLE t1 (a int) ENGINE=example ULL=1e2; CREATE TABLE t1 (a int) ENGINE=example ULL=0x1234; SHOW CREATE TABLE t1; + +ALTER TABLE t1 ULL=DEFAULT; +SHOW CREATE TABLE t1; + DROP TABLE t1; SET @@SQL_MODE=@OLD_SQL_MODE; -- cgit v1.2.1 From be7c84c7e7d441b9a28f8a956feb87884d02202b Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 May 2010 08:47:28 +0200 Subject: 5.1.46 after-merge fixes: must FLUSH TABLES before copying .frm. --- mysql-test/t/myisam.test | 1 + 1 file changed, 1 insertion(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 27b5a38978b..d498d4e95ad 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1641,6 +1641,7 @@ DROP TABLE t1; CREATE TABLE t1(a INT, b BIT(1)); INSERT INTO t1 VALUES(1, 0), (2, 1); CREATE TABLE t2 SELECT * FROM t1; +FLUSH TABLES; --copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t3.frm --copy_file $MYSQLD_DATADIR/test/t1.MYD $MYSQLD_DATADIR/test/t3.MYD --copy_file $MYSQLD_DATADIR/test/t1.MYI $MYSQLD_DATADIR/test/t3.MYI -- cgit v1.2.1 From 50ddf3c11135b4f2268bf8d123d8d2a56d58ddfe Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 May 2010 10:44:39 +0200 Subject: Fixed bug #53334. The fix actually reverts the change introduced by the patch for bug 51494 The fact is that the patch for bug 52177 fixes bug 51194 as well. --- mysql-test/t/innodb_mysql.test | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 1585895f8ba..78898759c73 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -591,4 +591,35 @@ ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b); DROP TABLE t1; +--echo # +--echo # Bug #53334: wrong result for outer join with impossible ON condition +--echo # (see the same test case for MyISAM in join.test) +--echo # + +create table t1 (id int primary key); +create table t2 (id int); + +insert into t1 values (75); +insert into t1 values (79); +insert into t1 values (78); +insert into t1 values (77); +replace into t1 values (76); +replace into t1 values (76); +insert into t1 values (104); +insert into t1 values (103); +insert into t1 values (102); +insert into t1 values (101); +insert into t1 values (105); +insert into t1 values (106); +insert into t1 values (107); + +insert into t2 values (107),(75),(1000); + +select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 + where t2.id=75 and t1.id is null; +explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 + where t2.id=75 and t1.id is null; + +drop table t1,t2; + --echo End of 5.1 tests -- cgit v1.2.1 From 5dd5d70506611ea68c7103fcf97512e3114fffae Mon Sep 17 00:00:00 2001 From: Kristofer Pettersson Date: Mon, 3 May 2010 18:14:39 +0200 Subject: Bug#50373 --secure-file-priv="" Iterative patch improvement. Previously committed patch caused wrong result on Windows. The previous patch also broke secure_file_priv for symlinks since not all file paths which must be compared against this variable are normalized using the same norm. The server variable opt_secure_file_priv wasn't normalized properly and caused the operations LOAD DATA INFILE .. INTO TABLE .. and SELECT load_file(..) to do different interpretations of the --secure-file-priv option. The patch moves code to the server initialization routines so that the path always is normalized once and only once. It was also intended that setting the option to an empty string should be equal to lifting all previously set restrictions. This is also fixed by this patch. mysql-test/r/loaddata.result: * Removed test code which will currently break the much used --mem feature of mtr. mysql-test/t/loaddata.test: * Removed test code which will currently break the much used --mem feature of mtr. sql/item_strfunc.cc: * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms. sql/mysql_priv.h: * Added signature for is_secure_file_path() sql/mysqld.cc: * New function for checking if a path compatible with the secure path restriction. * Added initialization of the opt_secure_file_priv variable. sql/sql_class.cc: * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms. sql/sql_load.cc: * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms. --- mysql-test/t/loaddata.test | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index e5f0a1d7eba..126bd5c8838 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -153,10 +153,16 @@ select * from t1; # # It should not be possible to load from a file outside of vardir ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -show variables like "secure_file_pri%"; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -select @@secure_file_priv; +## The following lines were disabled because of patch for +## bug 50373. MYSQLTEST_VARDIR doesn't rewrite symlinks +## to real paths, but this is done for secure_file_priv. +## Because of this the result can't be replaced if the +## test suite runs with the --mem option which creates +## symlinks to the ramdisk. +#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +#show variables like "secure_file_pri%"; +#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +#select @@secure_file_priv; --error 1238 set @@secure_file_priv= 0; -- cgit v1.2.1 From fcfb218f71b7d371a10df020994fc0a618639327 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 9 May 2010 21:30:06 +0200 Subject: Cherry-pick fix for Bug#53371, security hole with bypassing grants using special path in db/table names. Bump MariaDB version for security fix release. --- mysql-test/t/grant.test | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index e89650c7aec..5bdb3ebe9bf 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -1525,5 +1525,30 @@ DROP USER 'user1'@'localhost'; DROP USER 'user2'; DROP DATABASE db1; + +# +# Bug #53371: COM_FIELD_LIST can be abused to bypass table level grants. +# + +CREATE DATABASE db1; +CREATE DATABASE db2; +GRANT SELECT ON db1.* to 'testbug'@localhost; +USE db2; +CREATE TABLE t1 (a INT); +USE test; +connect (con1,localhost,testbug,,db1); +--error ER_NO_SUCH_TABLE +SELECT * FROM `../db2/tb2`; +--error ER_TABLEACCESS_DENIED_ERROR +SELECT * FROM `../db2`.tb2; +--error ER_NO_SUCH_TABLE +SELECT * FROM `#mysql50#/../db2/tb2`; +connection default; +disconnect con1; +DROP USER 'testbug'@localhost; +DROP TABLE db2.t1; +DROP DATABASE db1; +DROP DATABASE db2; + # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc -- cgit v1.2.1 From a3e8ae12805fb85a0b175b3ccbce36da62f8fdc4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 11 May 2010 16:49:23 +0200 Subject: A temporary solution to make CREATE TABLE attributes to work when a table is partitioned --- mysql-test/t/partition_example-master.opt | 1 + mysql-test/t/partition_example.test | 23 +++++++++++++++++++++++ mysql-test/t/plugin.test | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 mysql-test/t/partition_example-master.opt create mode 100644 mysql-test/t/partition_example.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/partition_example-master.opt b/mysql-test/t/partition_example-master.opt new file mode 100644 index 00000000000..367d5233e0e --- /dev/null +++ b/mysql-test/t/partition_example-master.opt @@ -0,0 +1 @@ +$EXAMPLE_PLUGIN_OPT diff --git a/mysql-test/t/partition_example.test b/mysql-test/t/partition_example.test new file mode 100644 index 00000000000..e6ac1bd222a --- /dev/null +++ b/mysql-test/t/partition_example.test @@ -0,0 +1,23 @@ +--source include/not_windows_embedded.inc +--source include/have_example_plugin.inc +--source include/have_partition.inc + +--replace_regex /\.dll/.so/ +eval install plugin example soname $HA_EXAMPLE_SO; + +create table t1 (a int not null) +engine=example +partition by list (a) +(partition p0 values in (1), partition p1 values in (2)); +show create table t1; +drop table t1; + +create table t1 (a int not null) +engine=example ull=12340 +partition by list (a) +(partition p0 values in (1), partition p1 values in (2)); +show create table t1; +drop table t1; + +select 1; +uninstall plugin example; diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index 3bbe615ebe6..7a1ca27d589 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -131,7 +131,7 @@ SET @@SQL_MODE=@OLD_SQL_MODE; # The only preparable statement above was CREATE TABLE. # We need to prepare another statement here to force the # previous one to be deallocated (mysqltest reuses the same handle) -# and to unlock all thread-local plugin locks. Otherwise it won't +# and to unlock all thread-local plugin locks. Otherwise the plugin won't # uninstall. # select 1; -- cgit v1.2.1 From c9b10e250d96d3f8eab22ebb698654da78fed5d8 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 12 May 2010 19:56:05 +0200 Subject: don't error out on unknown options in the replication thread or when opening a table --- mysql-test/t/create_options.test | 68 ---------------------------------------- mysql-test/t/table_options.test | 68 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 68 deletions(-) delete mode 100644 mysql-test/t/create_options.test create mode 100644 mysql-test/t/table_options.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/create_options.test b/mysql-test/t/create_options.test deleted file mode 100644 index 533e6829c00..00000000000 --- a/mysql-test/t/create_options.test +++ /dev/null @@ -1,68 +0,0 @@ ---disable_warnings -drop table if exists t1; ---enable_warnings - -SET @OLD_SQL_MODE=@@SQL_MODE; -SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS'; - -create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1='1v1'; -show create table t1; -drop table t1; - ---echo #reassiginig options in the same line -create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1 TKEY1=DEFAULT tkey1=1v2 tkey2=2v1; -show create table t1; - --- echo #add option -alter table t1 tkey4=4v1; -show create table t1; - ---echo #remove options -alter table t1 tkey3=DEFAULT tkey4=DEFAULT; -show create table t1; - -drop table t1; - -create table t1 (a int fkey1=v1, key akey (a) kkey1=v1) tkey1=1v1 tkey1=1v2 TKEY1=DEFAULT tkey2=2v1 tkey3=3v1; -show create table t1; - ---echo #change field with option with the same value -alter table t1 change a a int `FKEY1`='v1'; -show create table t1; ---echo #change field with option with a different value -alter table t1 change a a int fkey1=v2; -show create table t1; ---echo #new column no options -alter table t1 add column b int; -show create table t1; ---echo #new key with options -alter table t1 add key bkey (b) kkey2=v1; -show create table t1; ---echo #new column with options -alter table t1 add column c int fkey1=v1 fkey2=v2; -show create table t1; ---echo #new key no options -alter table t1 add key ckey (c); -show create table t1; ---echo #drop column -alter table t1 drop b; -show create table t1; ---echo #add column with options after delete -alter table t1 add column b int fkey2=v1; -show create table t1; ---echo #add key -alter table t1 add key bkey (b) kkey2=v2; -show create table t1; -drop table t1; - -#numeric (unquoted) value -create table t1 (a int) tkey1=100; -show create table t1; -drop table t1; - ---echo #error on unknown option -SET SQL_MODE=''; ---error ER_UNKNOWN_OPTION -create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1; - -SET @@SQL_MODE=@OLD_SQL_MODE; diff --git a/mysql-test/t/table_options.test b/mysql-test/t/table_options.test new file mode 100644 index 00000000000..533e6829c00 --- /dev/null +++ b/mysql-test/t/table_options.test @@ -0,0 +1,68 @@ +--disable_warnings +drop table if exists t1; +--enable_warnings + +SET @OLD_SQL_MODE=@@SQL_MODE; +SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS'; + +create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1='1v1'; +show create table t1; +drop table t1; + +--echo #reassiginig options in the same line +create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1 TKEY1=DEFAULT tkey1=1v2 tkey2=2v1; +show create table t1; + +-- echo #add option +alter table t1 tkey4=4v1; +show create table t1; + +--echo #remove options +alter table t1 tkey3=DEFAULT tkey4=DEFAULT; +show create table t1; + +drop table t1; + +create table t1 (a int fkey1=v1, key akey (a) kkey1=v1) tkey1=1v1 tkey1=1v2 TKEY1=DEFAULT tkey2=2v1 tkey3=3v1; +show create table t1; + +--echo #change field with option with the same value +alter table t1 change a a int `FKEY1`='v1'; +show create table t1; +--echo #change field with option with a different value +alter table t1 change a a int fkey1=v2; +show create table t1; +--echo #new column no options +alter table t1 add column b int; +show create table t1; +--echo #new key with options +alter table t1 add key bkey (b) kkey2=v1; +show create table t1; +--echo #new column with options +alter table t1 add column c int fkey1=v1 fkey2=v2; +show create table t1; +--echo #new key no options +alter table t1 add key ckey (c); +show create table t1; +--echo #drop column +alter table t1 drop b; +show create table t1; +--echo #add column with options after delete +alter table t1 add column b int fkey2=v1; +show create table t1; +--echo #add key +alter table t1 add key bkey (b) kkey2=v2; +show create table t1; +drop table t1; + +#numeric (unquoted) value +create table t1 (a int) tkey1=100; +show create table t1; +drop table t1; + +--echo #error on unknown option +SET SQL_MODE=''; +--error ER_UNKNOWN_OPTION +create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1; + +SET @@SQL_MODE=@OLD_SQL_MODE; -- cgit v1.2.1 From 73d3805d0078f8a89d7c8d47d22ae30cd2cc0b49 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 14 May 2010 14:56:14 +0300 Subject: Fixed build failures and compiler warning mysql-test/suite/binlog/r/binlog_unsafe.result: Updated results (RAND() doesn't require statement based logging anymore for inserts) mysql-test/t/information_schema_all_engines.test: Ensure that InnoDB is used storage/pbxt/bin/Makefile.am: Fixed build failure on build hosts (Patch from Kristian Nielsen) storage/pbxt/bin/xtstat_xt.cc: Added missing argument storage/pbxt/src/datalog_xt.cc: Fixed compiler warnings storage/pbxt/src/ha_pbxt.cc: Fixed compiler warnings storage/pbxt/src/table_xt.cc: Fixed compiler warnings support-files/compiler_warnings.supp: Added suppression of compiler warnings in Xtradb (Failure can only happen for corrupted tables, but should be fixed properly at some point) --- mysql-test/t/information_schema_all_engines.test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/information_schema_all_engines.test b/mysql-test/t/information_schema_all_engines.test index cb8fcf55c56..b3b1d2d2f6b 100644 --- a/mysql-test/t/information_schema_all_engines.test +++ b/mysql-test/t/information_schema_all_engines.test @@ -4,7 +4,8 @@ --source include/not_embedded.inc --source include/have_pbxt.inc --- source include/not_staging.inc +--source include/have_innodb.inc +--source include/not_staging.inc use INFORMATION_SCHEMA; --replace_result Tables_in_INFORMATION_SCHEMA Tables_in_information_schema -- cgit v1.2.1 From 3b98d69d689efcaba97476f34537fde24cfd5451 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 14 May 2010 23:45:32 +0200 Subject: crash on --with-embedded-privilege-control builds: 1. fix broken change user handling (no restart should happen in the normal case) 2. add assert to guarantee that we never send a request to change to the same plugin 3. "fix" plugin string as sent by the client to be able to compare native plugins by pointers 4. more complete MYSQL initialization in the embedded case 5. change_user.test updated to handle -with-embedded-privilege-control builds --- mysql-test/t/change_user.test | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/change_user.test b/mysql-test/t/change_user.test index b529ab7539b..5639e013de8 100644 --- a/mysql-test/t/change_user.test +++ b/mysql-test/t/change_user.test @@ -6,19 +6,30 @@ grant select on test.* to test_nopw; grant select on test.* to test_oldpw identified by password "09301740536db389"; grant select on test.* to test_newpw identified by "newpw"; +select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); + # # massaging the data for tests to pass in the embedded server, -# that has authentication completely disabled. +# that has authentication completely disabled or, if enabled, can +# only do new auth (20-byte scramble). # ---replace_result <@> @> @localhost> -select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); - change_user test_nopw; --replace_result <@> @> @localhost> select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); + +# +# embedded with enabled privilege control cannot do plugin negotiation. +# that is, it cannot try to authenticate with a new scramble, receive a request +# to switch to an old scramble, and retry with an old scramble. +# As a result, it cannot change to a user that has old scramble and +# and it stays logged as a previous user - test_nopw in this test file. +# For the embedded with auth we replace nopw with oldpw in the results. +# +let $repl = `select if(version() like '%embedded%' and user() like '%nopw%', 'nopw', 'oldpw')`; + change_user test_oldpw, oldpw; ---replace_result <@> @> @localhost> +--replace_result <@> @> @localhost> $repl oldpw select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); change_user test_newpw, newpw; --replace_result <@> @> @localhost> @@ -31,7 +42,7 @@ change_user test_nopw,,test; --replace_result <@> @> @localhost> select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); change_user test_oldpw,oldpw,test; ---replace_result <@> @> @localhost> +--replace_result <@> @> @localhost> $repl oldpw select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); change_user test_newpw,newpw,test; --replace_result <@> @> @localhost> -- cgit v1.2.1 From d120c5b562629dda782e3c9a66cfeaa48cbb01d1 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Tue, 25 May 2010 23:14:18 -0700 Subject: Changed the fixes for the following bugs: Bug #39022: completed Bug #39653: reverted as invalid Bug #45640: ameliorated, simplified, optimized Bug #48483: completed Bug #49324: improved Bug #51242/52336: reverted, applied a real fix. --- mysql-test/t/innodb_mysql.test | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 78898759c73..dae708b9e18 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -560,23 +560,6 @@ drop table t1,t2; --echo # ---echo # ---echo # Bug #39653: find_shortest_key in sql_select.cc does not consider ---echo # clustered primary keys ---echo # - -CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT, f INT, - KEY (b,c)) ENGINE=INNODB; - -INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3), - (4,4,4,4,4,4), (5,5,5,5,5,5), (6,6,6,6,6,6), - (7,7,7,7,7,7), (8,8,8,8,8,8), (9,9,9,9,9,9), - (11,11,11,11,11,11); - ---query_vertical EXPLAIN SELECT COUNT(*) FROM t1 - -DROP TABLE t1; - --echo # --echo # Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may --echo # corrupt definition at engine -- cgit v1.2.1 From e44633c8778354e5f9f71dd7e66fa972f9caeed0 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 26 May 2010 18:33:40 +0200 Subject: rename "partitioned key cache" to "segmented" --- mysql-test/t/key_cache.test | 110 ++++++++++++++++--------------- mysql-test/t/select_pkeycache-master.opt | 2 +- mysql-test/t/select_pkeycache.test | 4 +- 3 files changed, 59 insertions(+), 57 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index 274e47ec6ca..d77ce243e32 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -1,5 +1,5 @@ # -# Test of multiple key caches, simple an partitioned +# Test of multiple key caches, simple and segmented # --disable_warnings drop table if exists t1, t2, t3; @@ -7,7 +7,7 @@ drop table if exists t1, t2, t3; SET @save_key_buffer_size=@@key_buffer_size; SET @save_key_cache_block_size=@@key_cache_block_size; -SET @save_key_cache_partitions=@@key_cache_partitions; +SET @save_key_cache_segments=@@key_cache_segments; SELECT @@key_buffer_size, @@small.key_buffer_size; @@ -250,8 +250,10 @@ DROP TABLE t1; # End of 4.1 tests +# End of 5.1 tests + # -# Test cases for partitioned key caches +# Test cases for segmented key caches # # Test usage of the KEY_CACHE table from information schema @@ -261,7 +263,7 @@ set global key_buffer_size=@save_key_buffer_size; set global key_cache_block_size=@save_key_cache_block_size; select @@key_buffer_size; select @@key_cache_block_size; -select @@key_cache_partitions; +select @@key_cache_segments; create table t1 ( p int not null auto_increment primary key, @@ -270,9 +272,9 @@ create table t2 ( p int not null auto_increment primary key, i int, a char(10), key k1(i), key k2(a)); -select @@key_cache_partitions; +select @@key_cache_segments; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; insert into t1 values (1, 'qqqq'), (2, 'yyyy'); insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), @@ -285,26 +287,26 @@ update t2 set i=2 where i=1; --replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED show status like 'key_%'; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; delete from t2 where a='zzzz'; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; delete from t1; delete from t2; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; -# For the key cache with 2 partitions execute the same sequence of +# For the key cache with 2 segments execute the same sequence of # statements as for the simple cache above. # The statistical information on the number of i/o requests and # the number of is expected to be the same. -set global key_cache_partitions=2; -select @@key_cache_partitions; +set global key_cache_segments=2; +select @@key_cache_segments; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; insert into t1 values (1, 'qqqq'), (2, 'yyyy'); insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), @@ -317,19 +319,19 @@ update t2 set i=2 where i=1; --replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1788 KEY_BLOCKS_UNUSED show status like 'key_%'; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; delete from t1; delete from t2; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; -# Check that we can work with one partition with the same results +# Check that we can work with one segment with the same results -set global key_cache_partitions=1; -select @@key_cache_partitions; +set global key_cache_segments=1; +select @@key_cache_segments; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; insert into t1 values (1, 'qqqq'), (2, 'yyyy'); insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), @@ -342,25 +344,25 @@ update t2 set i=2 where i=1; --replace_result 1808 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED show status like 'key_%'; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; delete from t1; delete from t2; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; flush tables; flush status; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; -# Switch back to 2 partitions +# Switch back to 2 segments set global key_buffer_size=32*1024; select @@key_buffer_size; -set global key_cache_partitions=2; -select @@key_cache_partitions; +set global key_cache_segments=2; +select @@key_cache_segments; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; insert into t1 values (1, 'qqqq'), (2, 'yyyy'); insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), @@ -371,7 +373,7 @@ update t1 set p=3 where p=1; update t2 set i=2 where i=1; --replace_column 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; # Add more rows to tables t1 and t2 @@ -394,31 +396,31 @@ insert into t2(i,a) select i,a from t2; insert into t2(i,a) select i,a from t2; --replace_column 6 # 7 # 10 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; select * from t1 where p between 1010 and 1020 ; select * from t2 where p between 1010 and 1020 ; --replace_column 6 # 7 # 10 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; flush tables; flush status; update t1 set a='zzzz' where a='qqqq'; update t2 set i=1 where i=2; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; -# Now test how we can work with 7 partitions +# Now test how we can work with 7 segments set global keycache1.key_buffer_size=256*1024; select @@keycache1.key_buffer_size; -set global keycache1.key_cache_partitions=7; -select @@keycache1.key_cache_partitions; +set global keycache1.key_cache_segments=7; +select @@keycache1.key_cache_segments; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; --replace_column 7 # select * from information_schema.key_caches where key_cache_name like "key%" - and partition_number is null; + and segment_number is null; cache index t1 key (`primary`) in keycache1; @@ -430,26 +432,26 @@ explain select count(*) from t1, t2 where t1.p = t2.i; select count(*) from t1, t2 where t1.p = t2.i; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; --replace_column 7 # select * from information_schema.key_caches where key_cache_name like "key%" - and partition_number is null; + and segment_number is null; cache index t2 in keycache1; update t2 set p=p+3000, i=2 where a='qqqq'; --replace_column 7 # select * from information_schema.key_caches where key_cache_name like "key%" - and partition_number is null; + and segment_number is null; set global keycache2.key_buffer_size=1024*1024; cache index t2 in keycache2; insert into t2 values (2000, 3, 'yyyy'); --replace_column 7 # select * from information_schema.key_caches where key_cache_name like "keycache2" - and partition_number is null; + and segment_number is null; --replace_column 7 # select * from information_schema.key_caches where key_cache_name like "key%" - and partition_number is null; + and segment_number is null; cache index t2 in keycache1; update t2 set p=p+5000 where a='zzzz'; @@ -461,51 +463,51 @@ select i from t2 where a='yyyy' and i=3; explain select a from t2 where a='yyyy' and i=3; select a from t2 where a='yyyy' and i=3 ; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; set global keycache1.key_cache_block_size=2*1024; insert into t2 values (7000, 3, 'yyyy'); --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; set global keycache1.key_cache_block_size=8*1024; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; insert into t2 values (8000, 3, 'yyyy'); --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; set global keycache1.key_buffer_size=64*1024; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; set global keycache1.key_cache_block_size=2*1024; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; set global keycache1.key_cache_block_size=8*1024; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; set global keycache1.key_buffer_size=0; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; set global keycache1.key_cache_block_size=8*1024; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; set global keycache1.key_buffer_size=0; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; set global keycache1.key_buffer_size=128*1024; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; set global keycache1.key_cache_block_size=1024; --replace_column 6 # 7 # -select * from information_schema.key_caches where partition_number is null; +select * from information_schema.key_caches where segment_number is null; drop table t1,t2; @@ -513,6 +515,6 @@ set global keycache1.key_buffer_size=0; set global keycache2.key_buffer_size=0; set global key_buffer_size=@save_key_buffer_size; -set global key_cache_partitions=@save_key_cache_partitions; +set global key_cache_segments=@save_key_cache_segments; -#End of 5.1 tests +# End of 5.2 tests diff --git a/mysql-test/t/select_pkeycache-master.opt b/mysql-test/t/select_pkeycache-master.opt index b4ba5b8ca5d..a6c0f247334 100644 --- a/mysql-test/t/select_pkeycache-master.opt +++ b/mysql-test/t/select_pkeycache-master.opt @@ -1 +1 @@ ---key_cache_partitions=7 +--key_cache_segments=7 diff --git a/mysql-test/t/select_pkeycache.test b/mysql-test/t/select_pkeycache.test index 4216e9a5156..e0ee96e937a 100644 --- a/mysql-test/t/select_pkeycache.test +++ b/mysql-test/t/select_pkeycache.test @@ -1,7 +1,7 @@ # -# Run select.test partitioned default key cache (with 7 partitions) -# (see setting the number of partitions in select_pkecache-master.opt) +# Run select.test with the segmented default key cache (with 7 segments) +# (see setting the number of segments in select_pkecache-master.opt) # The result is expected the same as for select.test # -- cgit v1.2.1 From 80ba8556e772fd7e4eb369c64bb32ca44f93e221 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Thu, 27 May 2010 20:18:31 +0300 Subject: Fixed compiler warnings Fixed failing test innodb.innodb-autoinc.test Enabled innodb test suite mysql-test/mysql-test-run.pl: Enabled innodb test suite mysql-test/r/innodb-autoinc.result: Removed test as it exists in suite innodb mysql-test/suite/innodb/t/disabled.def: Removed innodb-autoinc mysql-test/suite/innodb/t/innodb-autoinc.test: Update to be able to run with plugin mysql-test/t/innodb-autoinc.test: Removed test as it exists in suite innodb sql/filesort.cc: Removed not used variable sql/slave.cc: Remove compiler warnings storage/pbxt/src/ha_pbxt.cc: Removed not used variable storage/xtradb/dict/dict0crea.c: Fixed compiler warning about unsigned comparison support-files/compiler_warnings.supp: Disable some not relevant warnings --- mysql-test/t/innodb-autoinc.test | 668 --------------------------------------- 1 file changed, 668 deletions(-) delete mode 100644 mysql-test/t/innodb-autoinc.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test deleted file mode 100644 index 68e10fa3095..00000000000 --- a/mysql-test/t/innodb-autoinc.test +++ /dev/null @@ -1,668 +0,0 @@ --- source include/have_innodb.inc -# embedded server ignores 'delayed', so skip this --- source include/not_embedded.inc - -let $file_format_check=`select @@innodb_file_format_check`; - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# Bug #34335 -# -CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (9223372036854775807, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -## Test AUTOINC overflow -## - -# TINYINT -CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (127, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (255, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -# SMALLINT -# -CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (32767, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (65535, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -# MEDIUMINT -# -CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (8388607, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (16777215, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -# INT -# -CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (2147483647, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (4294967295, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -# BIGINT -# -CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (9223372036854775807, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (18446744073709551615, null); --- error ER_AUTOINC_READ_FAILED,1467 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Bug 37531 -# After truncate, auto_increment behaves incorrectly for InnoDB -# -CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -SHOW CREATE TABLE t1; -TRUNCATE TABLE t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; - -# -# Deleting all records should not reset the AUTOINC counter. -# -CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -SHOW CREATE TABLE t1; -DELETE FROM t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; - -# -# Bug 38839 -# Reset the last value generated at end of statement -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL, 1); -DELETE FROM t1 WHERE c1 = 1; -INSERT INTO t1 VALUES (2,1); -INSERT INTO t1 VALUES (NULL,8); -SELECT * FROM t1; -DROP TABLE t1; -# Bug 38839 -- same as above but for multi value insert -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL, 1); -DELETE FROM t1 WHERE c1 = 1; -INSERT INTO t1 VALUES (2,1), (NULL, 8); -INSERT INTO t1 VALUES (NULL,9); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Test changes to AUTOINC next value calculation -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL),(5),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# Test with SIGNED INT column, by inserting a 0 for the first column value -# 0 is treated in the same was NULL. -# Reset the AUTOINC session variables -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(0); -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -SET @@INSERT_ID=400; -# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# Test with SIGNED INT column -# Reset the AUTOINC session variables -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-1); -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "auto_inc%"; -INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# Test with UNSIGNED INT column, single insert -# The sign in the value is ignored and a new column value is generated -# Reset the AUTOINC session variables -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-1); -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "auto_inc%"; -INSERT INTO t1 VALUES (-2); -INSERT INTO t1 VALUES (NULL); -INSERT INTO t1 VALUES (2); -INSERT INTO t1 VALUES (NULL); -INSERT INTO t1 VALUES (250); -INSERT INTO t1 VALUES (NULL); -SELECT * FROM t1; -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# Test with UNSIGNED INT column, multi-value inserts -# The sign in the value is ignored and a new column value is generated -# Reset the AUTOINC session variables -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-1); -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "auto_inc%"; -INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Check for overflow handling when increment is > 1 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (9223372036854775794); #-- 2^63 - 14 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "auto_inc%"; -# This should just fit -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Check for overflow handling when increment and offser are > 1 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "auto_inc%"; -# This should fail because of overflow but it doesn't, it seems to be -# a MySQL server bug. It wraps around to 0 for the last value. -# See MySQL Bug# 39828 -# -# Instead of wrapping around, it asserts when MySQL is compiled --with-debug -# (see sql/handler.cc:handler::update_auto_increment()). Don't test for -# overflow until Bug #39828 is fixed. -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -#INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -#else -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -#endif -SELECT * FROM t1; -DROP TABLE t1; - -# -# Check for overflow handling when increment and offset are odd numbers -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; -SHOW VARIABLES LIKE "auto_inc%"; -# This should fail because of overflow but it doesn't. It fails with -# a duplicate entry message because of a MySQL server bug, it wraps -# around. See MySQL Bug# 39828, once MySQL fix the bug we can replace -# the ER_DUP_ENTRY, 1062 below with the appropriate error message -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -# Still need to fix this error code, error should mention overflow -#-- error ER_DUP_ENTRY,1062 -#INSERT INTO t1 VALUES (NULL),(NULL), (NULL); -#else -INSERT INTO t1 VALUES (NULL),(NULL); -#endif -SELECT * FROM t1; -DROP TABLE t1; - -# Check for overflow handling when increment and offset are odd numbers -# and check for large -ve numbers -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES(-9223372036854775806); #-- -2^63 + 2 -INSERT INTO t1 VALUES(-9223372036854775807); #-- -2^63 + 1 -INSERT INTO t1 VALUES(-9223372036854775808); #-- -2^63 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3; -SHOW VARIABLES LIKE "auto_inc%"; -INSERT INTO t1 VALUES (NULL),(NULL), (NULL); -SELECT * FROM t1; -DROP TABLE t1; -# -# Check for overflow handling when increment and offset are very -# large numbers 2^60 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; -SHOW VARIABLES LIKE "auto_inc%"; -# This should fail because of overflow but it doesn't. It wraps around -# and the autoinc values look bogus too. -# See MySQL Bug# 39828, once MySQL fix the bug we can enable the error -# code expected test. -# -- error ER_AUTOINC_READ_FAILED,1467 -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -#-- error ER_AUTOINC_READ_FAILED,1467 -#INSERT INTO t1 VALUES (NULL),(NULL); -#else -INSERT INTO t1 VALUES (NULL); -#endif -SELECT * FROM t1; -DROP TABLE t1; - -# -# Check for floating point autoinc column handling -# -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "auto_inc%"; -CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL, 1); -INSERT INTO t1 VALUES(NULL, 2); -SELECT * FROM t1; -ALTER TABLE t1 CHANGE c1 c1 SERIAL; -SELECT * FROM t1; -INSERT INTO t1 VALUES(NULL, 3); -INSERT INTO t1 VALUES(NULL, 4); -SELECT * FROM t1; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL, 1); -INSERT INTO t1 VALUES(NULL, 2); -SELECT * FROM t1; -ALTER TABLE t1 CHANGE c1 c1 SERIAL; -SELECT * FROM t1; -INSERT INTO t1 VALUES(NULL, 3); -INSERT INTO t1 VALUES(NULL, 4); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Bug# 42714: AUTOINC column calculated next value not greater than highest -# value stored in table. -# -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5; -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -CREATE TABLE t1 ( - a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - b INT(10) UNSIGNED NOT NULL, - c ENUM('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (a)) ENGINE = InnoDB; -CREATE TABLE t2 ( - m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - n INT(10) UNSIGNED NOT NULL, - o enum('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (m)) ENGINE = InnoDB; -INSERT INTO t2 (n,o) VALUES - (1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'), - (3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false'); -SHOW CREATE TABLE t2; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; -SELECT * FROM t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SELECT * FROM t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SELECT * FROM t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -DROP TABLE t2; -# -# 43203: Overflow from auto incrementing causes server segv -# - -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -CREATE TABLE t1( - c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT - PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -CREATE TABLE t2( - c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT - PRIMARY KEY) ENGINE=InnoDB; --- error ER_DUP_ENTRY,1062 -INSERT INTO t2 SELECT c1 FROM t1; --- error ER_DUP_ENTRY,1467 -INSERT INTO t2 SELECT NULL FROM t1; -DROP TABLE t1; -DROP TABLE t2; - -# If the user has specified negative values for an AUTOINC column then -# InnoDB should ignore those values when setting the table's max value. -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SHOW VARIABLES LIKE "auto_inc%"; -# TINYINT -CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-127, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-127, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; -# -# SMALLINT -# -CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-32767, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-32757, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; -# -# MEDIUMINT -# -CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-8388607, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-8388607, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; -# -# INT -# -CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-2147483647, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-2147483647, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; -# -# BIGINT -# -CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-9223372036854775807, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, NULL); -INSERT INTO t1 VALUES (-1, 'innodb'); -INSERT INTO t1 VALUES (-9223372036854775807, 'innodb'); -INSERT INTO t1 VALUES (NULL, NULL); -SHOW CREATE TABLE t1; -SELECT * FROM t1; -DROP TABLE t1; -# -# End negative number check - -## -# 47125: auto_increment start value is ignored if an index is created -# and engine=innodb -# -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB; -CREATE INDEX i1 on t1(c2); -SHOW CREATE TABLE t1; -INSERT INTO t1 (c2) values (0); -SELECT * FROM t1; -DROP TABLE t1; - -## -# 49032: Use the correct function to read the AUTOINC column value -# -CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; -INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); -# Restart the server --- source include/restart_mysqld.inc -INSERT INTO t1(C2) VALUES ('innodb'); -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; -INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); -# Restart the server --- source include/restart_mysqld.inc -INSERT INTO t1(C2) VALUES ('innodb'); -SHOW CREATE TABLE t1; -DROP TABLE t1; - -## -# 47720: REPLACE INTO Autoincrement column with negative values -# -CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t1 SET c1 = 1; -SHOW CREATE TABLE t1; -INSERT INTO t1 SET c1 = 2; -INSERT INTO t1 SET c1 = -1; -SELECT * FROM t1; --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 SET c1 = -1; -SHOW CREATE TABLE t1; -REPLACE INTO t1 VALUES (-1); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; - -## -# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL); -INSERT INTO t1 VALUES (4), (5), (6), (NULL); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL); -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; - ---disable_query_log -EVAL SET GLOBAL innodb_file_format_check=$file_format_check; ---enable_query_log -- cgit v1.2.1