diff options
Diffstat (limited to 'mysql-test/t')
31 files changed, 1050 insertions, 80 deletions
diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test index ff23b352b5a..2234d2c680f 100644 --- a/mysql-test/t/check.test +++ b/mysql-test/t/check.test @@ -53,5 +53,29 @@ REPAIR TABLE t1; DROP TABLE t1; +--echo # +--echo # Bug#56422 CHECK TABLE run when the table is locked reports corruption +--echo # along with timeout +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1(a INT); +LOCK TABLE t1 WRITE; + +--echo # Connection con1 +connect(con1, localhost, root); +SET lock_wait_timeout= 1; +CHECK TABLE t1; + +--echo # Connection default +connection default; +UNLOCK TABLES; +DROP TABLE t1; +disconnect con1; + + # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test index 5f56cdf54e1..3a2bc982ad3 100644 --- a/mysql-test/t/delayed.test +++ b/mysql-test/t/delayed.test @@ -552,3 +552,52 @@ disconnect con1; connection default; DROP TABLE t1, t2, t3; --enable_ps_protocol + + +--echo # +--echo # Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables". +--echo # +connect (con1,localhost,root,,); +connection default; +--disable_warnings +drop table if exists t1, t2, tm; +--enable_warnings +create table t1(a int); +create table t2(a int); +create table tm(a int) engine=merge union=(t1, t2); +begin; +select * from t1; + +--echo # Connection 'con1'. +connection con1; +--echo # Sending: +--send alter table t1 comment 'test' + +--echo # Connection 'default'. +connection default; +--echo # Wait until ALTER TABLE blocks and starts waiting +--echo # for connection 'default'. It should wait with a +--echo # pending SNW lock on 't1'. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "alter table t1 comment 'test'"; +--source include/wait_condition.inc +--echo # Attempt to perform delayed insert into 'tm' should not lead +--echo # to a deadlock. Instead error ER_DELAYED_NOT_SUPPORTED should +--echo # be emitted. +--error ER_DELAYED_NOT_SUPPORTED +insert delayed into tm values (1); +--echo # Unblock ALTER TABLE. +commit; + +--echo # Connection 'con1'. +connection con1; +--echo # Reaping ALTER TABLE: +--reap + +disconnect con1; +--source include/wait_until_disconnected.inc +--echo # Connection 'default'. +connection default; +drop tables tm, t1, t2; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 8a1f91086d2..d35d612f93c 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,10 +11,9 @@ ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. lowercase_table3 : Bug#54845 2010-06-30 alik main.lowercase_table3 on Mac OSX +mysqlhotcopy_myisam : Bug#54129 2010-08-31 alik mysqlhotcopy* fails +mysqlhotcopy_archive : Bug#54129 2010-08-31 alik mysqlhotcopy* fails partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings -plugin : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 -plugin_load : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 -plugin_not_embedded : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically sp_sync : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution ctype_utf8mb4_ndb : Bug#55799, Bug#51907, disabled by Konstantin 2010-08-06 diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test index d4c3533847d..1cafbe3e6bd 100644 --- a/mysql-test/t/flush.test +++ b/mysql-test/t/flush.test @@ -546,3 +546,34 @@ disconnect con2; connection default; drop table t1; + +--echo # +--echo # Test for bug #55273 "FLUSH TABLE tm WITH READ LOCK for Merge table +--echo # causes assert failure". +--echo # +--disable_warnings +drop table if exists t1, t2, tm; +--enable_warnings +create table t1 (i int); +create table t2 (i int); +create table tm (i int) engine=merge union=(t1, t2); +insert into t1 values (1), (2); +insert into t2 values (3), (4); +--echo # The below statement should succeed and lock merge +--echo # table for read. Only merge table gets flushed and +--echo # not underlying tables. +flush tables tm with read lock; +select * from tm; +--echo # Check that underlying tables are locked. +select * from t1; +select * from t2; +unlock tables; +--echo # This statement should succeed as well and flush +--echo # all tables in the list. +flush tables tm, t1, t2 with read lock; +select * from tm; +--echo # Naturally, underlying tables should be locked in this case too. +select * from t1; +select * from t2; +unlock tables; +drop tables tm, t1, t2; diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 36a8542f9eb..0624fce3a34 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -742,7 +742,6 @@ DROP TABLE t1; --echo End of 5.1 tests - # # Bug#36785: Wrong error message when group_concat() exceeds max length # diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index f6dd6478a93..ec71e950ca7 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -492,4 +492,16 @@ SELECT COALESCE(a) = COALESCE(b) FROM t1; DROP TABLE t1; ---echo End of tests +--echo # +--echo # Bug #54461: crash with longblob and union or update with subquery +--echo # + +CREATE TABLE t1 (a INT, b LONGBLOB); +INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2'); + +SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; +SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; + +DROP TABLE t1; + +--echo End of 5.1 tests diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 1aeb2fa5b14..4aad3f80b68 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -404,6 +404,7 @@ create table t1 (a int, b blob); insert into t1 values (1, ''), (2, NULL), (3, '1'); select * from t1; +--error ER_ILLEGAL_VALUE_FOR_TYPE select geometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL, aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL, @@ -422,6 +423,7 @@ select intersects(b, b) IS NULL, crosses(b, b) IS NULL from t1; +--error ER_ILLEGAL_VALUE_FOR_TYPE select point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL, multilinestring(b) IS NULL, multipolygon(b) IS NULL, @@ -705,25 +707,45 @@ drop table t1; # Bug#44684: valgrind reports invalid reads in # Item_func_spatial_collection::val_str # +--error ER_ILLEGAL_VALUE_FOR_TYPE SELECT MultiPoint(12345,''); -SELECT MultiPoint(123451,''); -SELECT MultiPoint(1234512,''); -SELECT MultiPoint(12345123,''); - -SELECT MultiLineString(12345,''); -SELECT MultiLineString(123451,''); -SELECT MultiLineString(1234512,''); -SELECT MultiLineString(12345123,''); - -SELECT LineString(12345,''); -SELECT LineString(123451,''); -SELECT LineString(1234512,''); -SELECT LineString(12345123,''); - -SELECT Polygon(12345,''); -SELECT Polygon(123451,''); -SELECT Polygon(1234512,''); -SELECT Polygon(12345123,''); +#SELECT MultiPoint(123451,''); +#SELECT MultiPoint(1234512,''); +#SELECT MultiPoint(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT MultiLineString(12345,''); +#SELECT MultiLineString(123451,''); +#SELECT MultiLineString(1234512,''); +#SELECT MultiLineString(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT LineString(12345,''); +#SELECT LineString(123451,''); +#SELECT LineString(1234512,''); +#SELECT LineString(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT Polygon(12345,''); +#SELECT Polygon(123451,''); +#SELECT Polygon(1234512,''); +#SELECT Polygon(12345123,''); + +# +# Bug55531 crash with conversions of geometry types / strings +# +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b)); + + +--echo # +--echo # BUG#51875: crash when loading data into geometry function polyfromwkb +--echo # +SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=POLYFROMWKB(@a); +SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=POLYFROMWKB(@a); + --echo End of 5.1 tests diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 43b373c9703..05d630edfb2 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -851,4 +851,74 @@ ENGINE=MERGE UNION=(t1,t2); SELECT t1.a FROM mm1,t1; DROP TABLE t1, t2, mm1; +#--echo # +#--echo # Bug #55568: user variable assignments crash server when used within +#--echo # query +#--echo # +# +# +# This test case is invalidated because of fix of bug 55531 +# The reason is that {1} is not a valid geometric collection. +# +#CREATE TABLE t1 (a INT); + +#INSERT INTO t1 VALUES (0), (1); + +#let $i=2; +#while ($i) +#{ +# SELECT MULTIPOINT( +# 1, +# ( +# SELECT MULTIPOINT( +# MULTIPOINT( +# 1, +# (SELECT COUNT(*) FROM (SELECT 1 FROM t1 GROUP BY a,a) d) +# ) +# ) FROM t1 +# ) +# ) != COUNT(*) q FROM t1 GROUP BY a; +# dec $i; +#} +# +#DROP TABLE t1; + +--echo # +--echo # Bug #54468: crash after item's print() function when ordering/grouping +--echo # by subquery +--echo # + +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (), (); + +SELECT 1 FROM t1 +GROUP BY +GREATEST(t1.a, + (SELECT 1 FROM + (SELECT t1.b FROM t1,t1 t2 + ORDER BY t1.a, t1.a LIMIT 1) AS d) + ); + +DROP TABLE t1; + +--echo # +--echo # Bug #53544: Server hangs during JOIN query in stored procedure called +--echo # twice in a row +--echo # + +CREATE TABLE t1(c INT); + +INSERT INTO t1 VALUES (1), (2); + +PREPARE stmt FROM "SELECT t2.c AS f1 FROM t1 LEFT JOIN + t1 t2 ON t1.c=t2.c RIGHT JOIN + t1 t3 ON t1.c=t3.c + GROUP BY f1;"; + +EXECUTE stmt; +EXECUTE stmt; + +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/log_tables_debug.test b/mysql-test/t/log_tables_debug.test index 19a62614608..78a1289b689 100644 --- a/mysql-test/t/log_tables_debug.test +++ b/mysql-test/t/log_tables_debug.test @@ -7,6 +7,7 @@ # changed (see explanation in log_state.test) let $fixed_bug38124 = 0; +--source include/not_embedded.inc --source include/have_debug.inc # Several subtests modify global variables. Save the initial values only here, diff --git a/mysql-test/t/lowercase_fs_off.test b/mysql-test/t/lowercase_fs_off.test index 86d1e084c29..1be0351f9bc 100644 --- a/mysql-test/t/lowercase_fs_off.test +++ b/mysql-test/t/lowercase_fs_off.test @@ -91,3 +91,14 @@ DROP DATABASE db1; use test; # End of 5.0 tests + + +--echo # +--echo # Extra test coverage for Bug#56595 RENAME TABLE causes assert on OS X +--echo # + +CREATE TABLE t1(a INT); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1; +RENAME TABLE t1 TO T1; +ALTER TABLE T1 RENAME t1; +DROP TABLE t1; diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test index 55c04d7870b..f7780d2003a 100644 --- a/mysql-test/t/mdl_sync.test +++ b/mysql-test/t/mdl_sync.test @@ -4532,6 +4532,68 @@ disconnect con2; disconnect con3; +--echo # +--echo # Bug#56292 Deadlock with ALTER TABLE and MERGE tables +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1, t2, m1; +--enable_warnings + +CREATE TABLE t1(a INT) engine=MyISAM; +CREATE TABLE t2(a INT) engine=MyISAM; +CREATE TABLE m1(a INT) engine=MERGE UNION=(t1, t2); + +INSERT INTO t1 VALUES (1), (2); +INSERT INTO t2 VALUES (3), (4); + +connect(con1, localhost, root); +connect(con2, localhost, root); + +--echo # Connection con1 +connection con1; +SET DEBUG_SYNC= 'mdl_upgrade_shared_lock_to_exclusive SIGNAL upgrade WAIT_FOR continue'; +--echo # Sending: +--send ALTER TABLE m1 engine=MERGE UNION=(t2, t1) + +--echo # Connection con2 +connection con2; +--echo # Waiting for ALTER TABLE to try lock upgrade +SET DEBUG_SYNC= 'now WAIT_FOR upgrade'; +--echo # Sending: +--send DELETE FROM t2 WHERE a = 3 + +--echo # Connection default +connection default; +--echo # Check that DELETE is waiting on a metadata lock and not a table lock. +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table metadata lock" AND + info = "DELETE FROM t2 WHERE a = 3"; +--source include/wait_condition.inc +--echo # Now that DELETE blocks on a metadata lock, we should be able to do +--echo # SELECT * FROM m1 here. SELECT used to be blocked by a DELETE table +--echo # lock request. +SELECT * FROM m1; +--echo # Resuming ALTER TABLE +SET DEBUG_SYNC= 'now SIGNAL continue'; + +--echo # Connection con1 +connection con1; +--echo # Reaping: ALTER TABLE m1 engine=MERGE UNION=(t2, t1) +--reap +--echo # Connection con2 +connection con2; +--echo # Reaping: DELETE FROM t2 WHERE a = 3 +--reap +--echo # Connection default +connection default; +DROP TABLE m1, t1, t2; +SET DEBUG_SYNC= 'RESET'; +disconnect con1; +disconnect con2; + + # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index b6ad3324d19..34d0b5bf237 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -2,6 +2,9 @@ # Test of MERGE TABLES # +# Save the initial number of concurrent sessions. +--source include/count_sessions.inc + # MERGE tables require MyISAM tables let $default=`select @@global.storage_engine`; set global storage_engine=myisam; @@ -1731,6 +1734,84 @@ t2 WHERE b SOUNDS LIKE e AND d = 1; DROP TABLE t2, t1; +--echo # +--echo # Bug#46339 - crash on REPAIR TABLE merge table USE_FRM +--echo # +--disable_warnings +DROP TABLE IF EXISTS m1, t1; +--enable_warnings +# +# Test derived from a proposal of Shane Bester. +# +CREATE TABLE t1 (c1 INT) ENGINE=MYISAM; +CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1) INSERT_METHOD=LAST; +# +# REPAIR ... USE_FRM with LOCK TABLES. +# +LOCK TABLE m1 READ; +REPAIR TABLE m1 USE_FRM; +UNLOCK TABLES; +# +# REPAIR ... USE_FRM without LOCK TABLES. +# +# This statement crashed the server (Bug#46339). +# +REPAIR TABLE m1 USE_FRM; +# +DROP TABLE m1,t1; +# +# Test derived from a proposal of Matthias Leich. +# +# Base table is missing. +# +CREATE TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1); +# +# This statement crashed the server (Bug#46339). +# +REPAIR TABLE m1 USE_FRM; +# +# Create base table. +# +CREATE TABLE t1 (f1 BIGINT) ENGINE = MyISAM; +# +# This statement crashed the server (Bug#46339). +# +REPAIR TABLE m1 USE_FRM; +# +# Normal repair as reference. +# +REPAIR TABLE m1; +# +# Cleanup. +# +DROP TABLE m1, t1; +# +# Same with temporary tables. +# +# Base table is missing. +# +CREATE TEMPORARY TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1); +# +# This statement crashed the server (Bug#46339). +# +REPAIR TABLE m1 USE_FRM; +# +# Create base table. +# +CREATE TEMPORARY TABLE t1 (f1 BIGINT) ENGINE=MyISAM; +# +# This statement crashed the server (Bug#46339). +# +REPAIR TABLE m1 USE_FRM; +# +# Normal repair as reference. +# +REPAIR TABLE m1; +# +# Cleanup. +# +DROP TABLE m1, t1; + --echo End of 5.1 tests --echo # @@ -2519,12 +2600,11 @@ UNLOCK TABLES; DROP TABLE m1, t1; --echo # ---echo # If children are to be altered, they need an explicit lock. +--echo # Locking the merge table will implicitly lock children. --echo # CREATE TABLE t1 (c1 INT); CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1); LOCK TABLE m1 WRITE; ---error ER_TABLE_NOT_LOCKED_FOR_WRITE ALTER TABLE t1 ADD INDEX (c1); LOCK TABLE m1 WRITE, t1 WRITE; ALTER TABLE t1 ADD INDEX (c1); @@ -2665,6 +2745,37 @@ drop view v1; drop temporary table tmp; drop table t1, t2, t3, m1, m2; + +--echo # +--echo # Bug#56494 Segfault in upgrade_shared_lock_to_exclusive() for +--echo # REPAIR of merge table +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1, t2, t_not_exists; +--enable_warnings + +CREATE TABLE t1(a INT); +ALTER TABLE t1 engine= MERGE UNION (t_not_exists); +# This caused the segfault +ANALYZE TABLE t1; +CHECK TABLE t1; +CHECKSUM TABLE t1; +OPTIMIZE TABLE t1; +REPAIR TABLE t1; + +# This caused an assert +REPAIR TABLE t1 USE_FRM; + +DROP TABLE t1; +CREATE TABLE t1(a INT); +CREATE TABLE t2(a INT) engine= MERGE UNION (t1); +# This caused an assert +REPAIR TABLE t2 USE_FRM; + +DROP TABLE t1, t2; + + --echo End of 6.0 tests --disable_result_log @@ -2672,3 +2783,7 @@ drop table t1, t2, t3, m1, m2; eval set global storage_engine=$default; --enable_result_log --enable_query_log + +# Check that all connections opened by test cases in this file are really +# gone so execution of other tests won't be affected by their presence. +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 166d36856a6..8ed0ed45b82 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -650,5 +650,26 @@ SET SESSION sql_safe_updates = 1; UPDATE IGNORE t1, t1 t1a SET t1.a = 1 WHERE t1a.a = 1; DROP TABLE t1; +--echo # +--echo # Bug#54543: update ignore with incorrect subquery leads to assertion +--echo # failure: inited==INDEX +--echo # +SET SESSION sql_safe_updates = 0; +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES (1), (2); + +CREATE TABLE t2 ( a INT ); +INSERT INTO t2 VALUES (1), (2); + +CREATE TABLE t3 ( a INT ); +INSERT INTO t3 VALUES (1), (2); + +--echo # Should not crash +UPDATE IGNORE + ( SELECT ( SELECT COUNT(*) FROM t1 GROUP BY a, @v ) a FROM t2 ) x, t3 +SET t3.a = 0; + +DROP TABLE t1, t2, t3; +SET SESSION sql_safe_updates = DEFAULT; --echo end of tests diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 031c51a0720..feb87dfe850 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -494,6 +494,32 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; --error 1 --exec echo "--disable_query_log;" | $MYSQL_TEST 2>&1 +# +# Extra text after `` +# +# Cannot use exec echo here as ` may or may not need to be escaped +--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql +let $x= `select 1` BOO ; +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 +remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; +--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql +--let $x= `select 1`; +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 +remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; +--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql +# Missing ; in next line should be detected and cause failure +let $x= `select 1` +let $x= 2; +echo $x; +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 +remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; + # Allow trailing # comment --sleep 1 # Wait for insert delayed to be executed. @@ -701,6 +727,16 @@ echo banana = $cat; let $cat=ba\\\$cat\\\$cat; echo Not a banana: $cat; +# Bug #55413 would cause this to fail +let $escape= with\`some\"escaped\'quotes; +echo $escape; + +--let $escape= with\`some\"escaped\'quotes +echo $escape; + +# This only works with "--let" syntax +--let $tick= single'tick`backtick +echo $tick; # Test illegal uses of let @@ -970,16 +1006,13 @@ EOF # ---------------------------------------------------------------------------- # Test inc # ---------------------------------------------------------------------------- -inc $i; -echo $i; +let $i= 0; inc $i; echo $i; let $i=100; inc $i; echo $i; - -let $i=hej; -echo $i; +let $i= -100; inc $i; echo $i; @@ -988,7 +1021,13 @@ echo $i; --error 1 --exec echo "inc i;" | $MYSQL_TEST 2>&1 --error 1 +--exec echo "inc \$i;" | $MYSQL_TEST 2>&1 +--error 1 --exec echo "let \$i=100; inc \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "let \$i=text; inc \$i; echo \$i;" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "let \$i=10cc; inc \$i; echo \$i;" | $MYSQL_TEST 2>&1 inc $i; inc $i; inc $i; --echo $i echo $i; @@ -998,25 +1037,25 @@ echo $i; # Test dec # ---------------------------------------------------------------------------- -dec $d; -echo $d; +let $d= 0; dec $d; echo $d; let $d=100; dec $d; echo $d; -let $d=hej; -echo $d; -dec $d; -echo $d; - --error 1 --exec echo "dec;" | $MYSQL_TEST 2>&1 --error 1 --exec echo "dec i;" | $MYSQL_TEST 2>&1 --error 1 +--exec echo "dec \$i;" | $MYSQL_TEST 2>&1 +--error 1 --exec echo "let \$i=100; dec \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "let \$i=text; dec \$i; echo \$i;" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "let \$i=10cc; dec \$i; echo \$i;" | $MYSQL_TEST 2>&1 # ---------------------------------------------------------------------------- @@ -1431,19 +1470,6 @@ eval select "$long_rep" as x; # Repeat connect/disconnect --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql -let $i=100; -while ($i) -{ - connect (test_con1,localhost,root,,); - disconnect test_con1; - dec $i; -} -EOF ---exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK; exit;" | $MYSQL_TEST 2>&1 -remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; - -# Repeat connect/disconnect ---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql let $i=200; while ($i) { @@ -1451,9 +1477,8 @@ while ($i) disconnect test_con1; dec $i; } +echo 200 connects succeeded; EOF ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---error 1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; @@ -1494,6 +1519,22 @@ show tables; disconnect con2; connection default; +# Test enable_connect_log +--enable_connect_log +connect (con1,localhost,root,,); +connection default; +connection con1; +--disable_query_log +# These should not be logged +connect (con2,localhost,root,,*NO-ONE*); +connection con2; +disconnect con2; +connection con1; +--enable_query_log +disconnect con1; +connection default; +--disable_connect_log + # ---------------------------------------------------------------------------- # Test mysqltest arguments # ---------------------------------------------------------------------------- diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 2ea169d950d..7869a01a84d 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -1467,6 +1467,31 @@ SELECT * FROM t1 FORCE INDEX FOR JOIN (a), t2 WHERE t1.a < 2 ORDER BY t1.a; DROP TABLE t1, t2; +--echo # +--echo # Bug #50394: Regression in EXPLAIN with index scan, LIMIT, GROUP BY and +--echo # ORDER BY computed col +--echo # +CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, KEY( a, b ) ); + +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); +INSERT INTO t1 SELECT a + 5, b + 5 FROM t1; + +CREATE TABLE t2( a INT PRIMARY KEY, b INT ); + +INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); +INSERT INTO t2 SELECT a + 5, b + 5 FROM t2; + +EXPLAIN +SELECT count(*) AS c, t1.a +FROM t1 JOIN t2 ON t1.b = t2.a +WHERE t2.b = 1 +GROUP BY t1.a +ORDER by c +LIMIT 2; + +DROP TABLE t1, t2; + + --echo End of 5.1 tests diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 1224dee24ed..68239c06660 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -14,6 +14,56 @@ drop table if exists t1, t2; --enable_warnings +--echo # +--echo # Bug#57113: ha_partition::extra(ha_extra_function): +--echo # Assertion `m_extra_cache' failed +CREATE TABLE t1 +(id INT NOT NULL PRIMARY KEY, + name VARCHAR(16) NOT NULL, + year YEAR, + INDEX name (name(8)) +) +PARTITION BY HASH(id) PARTITIONS 2; + +INSERT INTO t1 VALUES ( 1, 'FooBar', '1924' ); + +CREATE TABLE t2 (id INT); + +INSERT INTO t2 VALUES (1),(2); + +UPDATE t1, t2 SET t1.year = '1955' WHERE t1.name = 'FooBar'; + +DROP TABLE t1, t2; + + +--echo # +--echo # Bug#55458: Partitioned MyISAM table gets crashed by multi-table update +--echo # +CREATE TABLE t1 ( + `id` int NOT NULL, + `user_num` int DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM CHARSET=latin1; +INSERT INTO t1 VALUES (1,8601); +INSERT INTO t1 VALUES (2,8601); +INSERT INTO t1 VALUES (3,8601); +INSERT INTO t1 VALUES (4,8601); +CREATE TABLE t2 ( + `id` int(11) NOT NULL, + `user_num` int DEFAULT NULL, + `name` varchar(64) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM CHARSET=latin1 +PARTITION BY HASH (id) +PARTITIONS 2; +INSERT INTO t2 VALUES (1,8601,'John'); +INSERT INTO t2 VALUES (2,8601,'JS'); +INSERT INTO t2 VALUES (3,8601,'John S'); + +UPDATE t1, t2 SET t2.name = 'John Smith' WHERE t1.user_num = t2.user_num; + +DROP TABLE t1, t2; + --echo # Bug#39338: Fieldnames in --echo # INFORMATIONSCHEMA.PARTITIONS.PARTITION_EXPRESSION become unescaped --echo # NOTE: the partition expression is saved as a string, so changing from @@ -430,12 +480,12 @@ drop table t1; # # BUG 16002: Handle unsigned integer functions properly # ---error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR +--error ER_VALUES_IS_NOT_INT_TYPE_ERROR create table t1 (a bigint) partition by range (a) (partition p0 values less than (0xFFFFFFFFFFFFFFFF), partition p1 values less than (10)); ---error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR +--error ER_VALUES_IS_NOT_INT_TYPE_ERROR create table t1 (a bigint) partition by list (a) (partition p0 values in (0xFFFFFFFFFFFFFFFF), diff --git a/mysql-test/t/partition_binlog_stmt.test b/mysql-test/t/partition_binlog_stmt.test index bb52c2210f3..c426de9f303 100644 --- a/mysql-test/t/partition_binlog_stmt.test +++ b/mysql-test/t/partition_binlog_stmt.test @@ -8,10 +8,8 @@ DROP TABLE IF EXISTS t1; --echo # --echo # Bug#51851: Server with SBR locks mutex twice on LOAD DATA into --echo # partitioned MyISAM table -perl; -open( INIT, ">init_file.txt"); -print INIT "abcd\n"; -close( INIT ); +--write_file init_file.txt +abcd EOF CREATE TABLE t1 diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index 1496a626796..213778764b5 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -5,12 +5,109 @@ -- source include/have_partition.inc --disable_warnings -drop table if exists t1; +drop table if exists t1, t2; --enable_warnings let $MYSQLD_DATADIR= `SELECT @@datadir`; --echo # +--echo # Bug#50036: Inconsistent errors when using TIMESTAMP +--echo # columns/expressions + +--echo # 1. correct and appropriate errors in light of +--echo # the fix for BUG#42849: +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (c TIMESTAMP) +PARTITION BY RANGE (TO_DAYS(c)) +(PARTITION p0 VALUES LESS THAN (10000), + PARTITION p1 VALUES LESS THAN (MAXVALUE)); +CREATE TABLE t2 (c TIMESTAMP); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE t2 +PARTITION BY RANGE (TO_DAYS(c)) +(PARTITION p0 VALUES LESS THAN (10000), + PARTITION p1 VALUES LESS THAN (MAXVALUE)); + +--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD +CREATE TABLE t1 (c TIMESTAMP) +PARTITION BY RANGE COLUMNS(c) +(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'), + PARTITION p1 VALUES LESS THAN (MAXVALUE)); +--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD +ALTER TABLE t2 PARTITION BY RANGE COLUMNS(c) +(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'), + PARTITION p1 VALUES LESS THAN (MAXVALUE)); +DROP TABLE t2; + +--echo # 2. These errors where questionable before the fix: + +--echo # VALUES clause are checked first, clearified the error message. +--error ER_VALUES_IS_NOT_INT_TYPE_ERROR +CREATE TABLE t1 (c TIMESTAMP) +PARTITION BY RANGE (c) +(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'), + PARTITION p1 VALUES LESS THAN (MAXVALUE)); + +--echo # TIMESTAMP is not INT (e.g. UNIX_TIMESTAMP). +--error ER_VALUES_IS_NOT_INT_TYPE_ERROR +CREATE TABLE t1 (c TIMESTAMP) +PARTITION BY RANGE (UNIX_TIMESTAMP(c)) +(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'), + PARTITION p1 VALUES LESS THAN (MAXVALUE)); + +CREATE TABLE t1 (c TIMESTAMP) +PARTITION BY RANGE (UNIX_TIMESTAMP(c)) +(PARTITION p0 VALUES LESS THAN (UNIX_TIMESTAMP('2000-01-01 00:00:00')), + PARTITION p1 VALUES LESS THAN (MAXVALUE)); +DROP TABLE t1; + +--echo # Changed error from ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR +--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD +CREATE TABLE t1 (c TIMESTAMP) +PARTITION BY HASH (c) PARTITIONS 4; + +--echo # Added test with existing TIMESTAMP partitioning (when it was allowed). + +CREATE TABLE t1 (a TIMESTAMP) +PARTITION BY HASH (UNIX_TIMESTAMP(a)); +INSERT INTO t1 VALUES ('2000-01-02 03:04:05'); +--sorted_result +SELECT * FROM t1; +FLUSH TABLES; +--echo # replacing t1.frm with TO_DAYS(a) which was allowed earlier. +--remove_file $MYSQLD_DATADIR/test/t1.frm +--copy_file std_data/parts/t1TIMESTAMP.frm $MYSQLD_DATADIR/test/t1.frm +--echo # Disable warnings, since the result would differ when running with +--echo # --ps-protocol (only for the 'SELECT * FROM t1' statement). +--disable_warnings +--sorted_result +SELECT * FROM t1; +--enable_warnings +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('2001-02-03 04:05:06'); +--sorted_result +SELECT * FROM t1; +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE t1 +PARTITION BY RANGE (TO_DAYS(a)) +(PARTITION p0 VALUES LESS THAN (10000), + PARTITION p1 VALUES LESS THAN (MAXVALUE)); +SHOW CREATE TABLE t1; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; +CREATE TABLE t2 SELECT * FROM t1; +DROP TABLE t2; +ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a)); +SHOW CREATE TABLE t1; +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +SHOW CREATE TABLE t1; +--sorted_result +SELECT * FROM t1; +DROP TABLE t1; + +--echo # --echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes) --echo # CREATE TABLE t1 (a INT) PARTITION BY HASH (a); @@ -536,7 +633,7 @@ partitions 2 # # Partition by range, inconsistent partition function and constants # ---error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR +--error ER_VALUES_IS_NOT_INT_TYPE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -849,7 +946,7 @@ partitions 2 # # Partition by list, wrong constant result type (not INT) # ---error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR +--error ER_VALUES_IS_NOT_INT_TYPE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -939,13 +1036,13 @@ PARTITION pmax VALUES LESS THAN MAXVALUE); # Check that allowed arithmetic/math functions involving TIMESTAMP values result # in ER_PARTITION_FUNC_NOT_ALLOWED_ERROR when used as a partitioning function ---error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) PARTITION BY RANGE (a) ( PARTITION p VALUES LESS THAN (20080819), PARTITION pmax VALUES LESS THAN MAXVALUE); ---error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD ALTER TABLE old PARTITION BY RANGE (a) ( PARTITION p VALUES LESS THAN (20080819), @@ -1284,4 +1381,18 @@ PARTITION pmax VALUES LESS THAN MAXVALUE); DROP TABLE old; +--echo # +--echo # Bug #56709: Memory leaks at running the 5.1 test suite +--echo # + +CREATE TABLE t1 (a TIMESTAMP NOT NULL PRIMARY KEY); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE t1 +PARTITION BY RANGE (EXTRACT(DAY FROM a)) ( +PARTITION p VALUES LESS THAN (18), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 27f6ddde615..f2ca16b9259 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -9,6 +9,30 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; --enable_warnings --echo # +--echo # Bug#53806: Wrong estimates for range query in partitioned MyISAM table +--echo # Bug#46754: 'rows' field doesn't reflect partition pruning +--echo # +CREATE TABLE t1 (a INT PRIMARY KEY) +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (1), +PARTITION p1 VALUES LESS THAN (2), +PARTITION p2 VALUES LESS THAN (3), +PARTITION p3 VALUES LESS THAN (4), +PARTITION p4 VALUES LESS THAN (5), +PARTITION p5 VALUES LESS THAN (6), +PARTITION max VALUES LESS THAN MAXVALUE); + +INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7),(8); + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 # +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 # +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7; +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 # +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; +DROP TABLE t1; + +--echo # --echo # Bug#49742: Partition Pruning not working correctly for RANGE --echo # CREATE TABLE t1 (a INT PRIMARY KEY) diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index cec44078279..fb49ce23644 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -266,3 +266,22 @@ SELECT 1 FROM t1 WHERE ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234)); --enable_warnings DROP TABLE t1; + +--echo # +--echo # Bug #54190: Comparison to row subquery produces incorrect result +--echo # + +SELECT ROW(1,2) = (SELECT 1,2 FROM DUAL WHERE 1 = 0); +SELECT ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0); + +CREATE TABLE t1 (i INT); +INSERT INTO t1 () VALUES (1), (2), (3); + +SELECT ROW(1,2) = (SELECT 1,2 FROM t1 WHERE 1 = 0); +SELECT ROW(1,2) = (SELECT 1,3 FROM t1 WHERE 1 = 0); +SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,2 FROM DUAL WHERE 1 = 0); +SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0); + +DROP TABLE t1; + +--echo End of 5.1 tests diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 495b6002986..87f36c452f2 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3772,11 +3772,6 @@ SELECT 1 FROM t1 WHERE a <> 1 AND NOT ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1)) INTO @var0; -# Query correctly return 2 rows since comparison a <=> fisrt_subquery is -# always false, thus the second query is never executed. -SELECT 1 FROM t1 WHERE a <> 1 AND NOT -ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1)); - DROP TABLE t1; --echo # diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index 0dd324d5df2..fc522a69a3c 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -192,11 +192,11 @@ INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i')); # All test cases expected to fail should return # SQLSTATE 22007 <invalid date value> +--error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); - ---error 1292 +--error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); --error 1292 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); @@ -206,18 +206,18 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i')); --error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); ## Test INSERT with STR_TO_DATE into DATETIME # All test cases expected to fail should return # SQLSTATE 22007 <invalid datetime value> +--error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); - ---error 1292 +--error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); --error 1292 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); @@ -227,18 +227,18 @@ INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i')); --error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); ## Test INSERT with STR_TO_DATE into TIMESTAMP # All test cases expected to fail should return # SQLSTATE 22007 <invalid datetime value> ---error 1292 +--error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); --error 1292 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); @@ -248,7 +248,7 @@ INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i')); --error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); drop table t1; diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index a2c71c664c4..6727833eb44 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -74,6 +74,68 @@ CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) ); CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) ); DROP VIEW v1, v2; +--echo # +--echo # Bug#51070: Query with a NOT IN subquery predicate returns a wrong +--echo # result set +--echo # +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES ( 1, NULL ), ( 2, NULL ); + +CREATE TABLE t2 ( c INT, d INT ); +INSERT INTO t2 VALUES ( NULL, 3 ), ( NULL, 4 ); + +CREATE TABLE t3 ( e INT, f INT ); +INSERT INTO t3 VALUES ( NULL, NULL ), ( NULL, NULL ); + +CREATE TABLE t4 ( a INT ); +INSERT INTO t4 VALUES (1), (2), (3); + +CREATE TABLE t5 ( a INT ); +INSERT INTO t5 VALUES (NULL), (2); + +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ); +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ); + +EXPLAIN +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL; +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL; +SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) IS NULL; +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS UNKNOWN; +SELECT * FROM t1 WHERE (( a, b ) NOT IN ( SELECT c, d FROM t2 )) IS UNKNOWN; + +SELECT * FROM t1 WHERE 1 = 1 AND ( a, b ) NOT IN ( SELECT c, d FROM t2 ); + +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 ); +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 ); + +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 ); +SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 ); + +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 ); +SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 ); + +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 ); +SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 ); + +SELECT * FROM t1 WHERE ( a, b ) NOT IN + ( SELECT c, d FROM t2 WHERE c = 1 AND c <> 1 ); + +SELECT * FROM t1 WHERE b NOT IN ( SELECT c FROM t2 WHERE c = 1 ); + +SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 ); + +DROP TABLE t1, t2, t3, t4, t5; + --echo # --echo # End of 5.1 tests. diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test index 15ddceb8d68..c4445da107c 100644 --- a/mysql-test/t/timezone2.test +++ b/mysql-test/t/timezone2.test @@ -273,5 +273,14 @@ UNLOCK TABLES; DROP TABLE t1; +--echo # +--echo # Bug #55424: convert_tz crashes when fed invalid data +--echo # + +CREATE TABLE t1 (a SET('x') NOT NULL); +INSERT INTO t1 VALUES (''); +SELECT CONVERT_TZ(1, a, 1) FROM t1; +SELECT CONVERT_TZ(1, 1, a) FROM t1; +DROP TABLE t1; --echo End of 5.1 tests diff --git a/mysql-test/t/trigger_notembedded.test b/mysql-test/t/trigger_notembedded.test index 9728ae9a4ae..89857063ebd 100644 --- a/mysql-test/t/trigger_notembedded.test +++ b/mysql-test/t/trigger_notembedded.test @@ -932,4 +932,52 @@ disconnect con1; DROP USER 'no_rights'@'localhost'; DROP DATABASE db1; +# +# Bug#55421 Protocol::end_statement(): Assertion `0' on multi-table UPDATE IGNORE +# To reproduce a crash we need to provoke a trigger execution with +# the following conditions: +# - active SELECT statement during trigger execution +# (i.e. LEX::current_select != NULL); +# - IGNORE option (i.e. LEX::current_select->no_error == TRUE); +--disable_warnings +DROP DATABASE IF EXISTS mysqltest_db1; +--enable_warnings + +CREATE DATABASE mysqltest_db1; +USE mysqltest_db1; + +GRANT ALL ON mysqltest_db1.* TO mysqltest_u1@localhost; + +--connect(con1,localhost,mysqltest_u1,,mysqltest_db1) + +CREATE TABLE t1 ( + a1 int, + a2 int +); +INSERT INTO t1 VALUES (1, 20); + +CREATE TRIGGER mysqltest_db1.upd_t1 +BEFORE UPDATE ON t1 FOR EACH ROW SET new.a2 = 200; + +CREATE TABLE t2 ( + a1 int +); + +INSERT INTO t2 VALUES (2); + +--connection default + +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; + +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE IGNORE t1, t2 SET t1.a1 = 2, t2.a1 = 3 WHERE t1.a1 = 1 AND t2.a1 = 2; +# Cleanup + +DROP DATABASE mysqltest_db1; +DROP USER mysqltest_u1@localhost; + +--disconnect con1 +--connection default +USE test; + --echo End of 5.1 tests. diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index e607823764b..6e40c9ccfa0 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -462,5 +462,28 @@ DROP TABLE t1; SET NAMES latin1; --echo # +--echo # Bug#56271: Wrong comparison result with STR_TO_DATE function +--echo # +CREATE TABLE t1 ( + `year` int(4) NOT NULL, + `month` int(2) NOT NULL +); + +INSERT INTO t1 VALUES (2010,3),(2010,4),(2009,8),(2008,9); + +SELECT * +FROM t1 +WHERE STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') >= +STR_TO_DATE('1/1/2010', '%m/%d/%Y'); + +create table t2(f1 datetime primary key); +insert into t2 select STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') from t1; +select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y'); +--echo t2 should be const +explain select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y'); + +DROP TABLE t1,t2; + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 3f418a339cc..bd70e64b1ad 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1509,5 +1509,14 @@ group by PAY.id + 1; DROP TABLE currencies, payments, sub_tasks; +--echo # +--echo # BUG#52171: distinct aggregates on unsigned decimal fields trigger assertions +--echo # + +CREATE TABLE t1 (a DECIMAL(4,4) UNSIGNED); +INSERT INTO t1 VALUES (0); +SELECT AVG(DISTINCT a) FROM t1; +SELECT SUM(DISTINCT a) FROM t1; +DROP TABLE t1; --echo End of 5.1 tests diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index 5c3a759b589..dfac6f93b7d 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -347,6 +347,23 @@ DROP TABLE t1; --echo End of 5.0 tests +--echo # +--echo # Bug #55779: select does not work properly in mysql server +--echo # Version "5.1.42 SUSE MySQL RPM" +--echo # + +CREATE TABLE t1 (a TIMESTAMP, KEY (a)); + +INSERT INTO t1 VALUES ('2000-01-01 00:00:00'), ('2000-01-01 00:00:00'), + ('2000-01-01 00:00:01'), ('2000-01-01 00:00:01'); + +SELECT a FROM t1 WHERE a >= 20000101000000; +SELECT a FROM t1 WHERE a >= '20000101000000'; + +DROP TABLE t1; + +--echo End of 5.1 tests + --echo --echo Bug#50888 valgrind warnings in Field_timestamp::val_str --echo diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index fc4bc61f526..06508c43766 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -326,6 +326,24 @@ INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1); DROP TABLE t1; +# +# Bug #55615: debug assertion after using variable in assignment and +# referred to +# Bug #55564: crash with user variables, assignments, joins... +# + +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (0),(0); +--echo # BUG#55615 : should not crash +SELECT (@a:=(SELECT @a:=1 FROM t1 LIMIT 1)) AND COUNT(1) FROM t1 GROUP BY @a; +--echo # BUG#55564 : should not crash +SELECT IF( + @v:=LEAST((SELECT 1 FROM t1 t2 LEFT JOIN t1 ON (@v) GROUP BY t1.a), a), + count(*), 1) +FROM t1 GROUP BY a LIMIT 1; + +DROP TABLE t1; + --echo End of 5.1 tests # diff --git a/mysql-test/t/variables_debug.test b/mysql-test/t/variables_debug.test index 8fa2124137a..6a3bc749b2a 100644 --- a/mysql-test/t/variables_debug.test +++ b/mysql-test/t/variables_debug.test @@ -35,4 +35,92 @@ SELECT @@global.debug; SET GLOBAL debug=@old_debug; +--echo # +--echo # Bug #56709: Memory leaks at running the 5.1 test suite +--echo # + +SET @old_local_debug = @@debug; + +SET @@debug='d,foo'; +SELECT @@debug; +SET @@debug=''; +SELECT @@debug; + +SET @@debug = @old_local_debug; + --echo End of 5.1 tests + + +--echo # +--echo # Bug#46165 server crash in dbug +--echo # + +SET @old_globaldebug = @@global.debug; +SET @old_sessiondebug= @@session.debug; + +--echo # Test 1 - Bug test case, single connection +SET GLOBAL debug= '+O,../../log/bug46165.1.trace'; +SET SESSION debug= '-d:-t:-i'; + +SET GLOBAL debug= ''; +SET SESSION debug= ''; + +--echo # Test 2 - Bug test case, two connections +--echo # Connection default +connection default; +SET GLOBAL debug= '+O,../../log/bug46165.2.trace'; +SET SESSION debug= '-d:-t:-i'; + +--echo # Connection con1 +connect (con1, localhost, root); +SET GLOBAL debug= ''; + +--echo # Connection default +connection default; +SET SESSION debug= ''; +--echo # Connection con1 +connection con1; +disconnect con1; +--source include/wait_until_disconnected.inc +--echo # Connection default +connection default; +SET GLOBAL debug= ''; + +--echo # Test 3 - Active session trace file on disconnect +--echo # Connection con1 +connect (con1, localhost, root); +SET GLOBAL debug= '+O,../../log/bug46165.3.trace'; +SET SESSION debug= '-d:-t:-i'; +SET GLOBAL debug= ''; +disconnect con1; +--source include/wait_until_disconnected.inc + +--echo # Test 4 - Active session trace file on two connections +--echo # Connection default +connection default; +SET GLOBAL debug= '+O,../../log/bug46165.4.trace'; +SET SESSION debug= '-d:-t:-i'; + +--echo # Connection con1 +connect (con1, localhost, root); +SET SESSION debug= '-d:-t:-i'; +SET GLOBAL debug= ''; +SET SESSION debug= ''; + +--echo # Connection default +connection default; +SET SESSION debug= ''; +--echo # Connection con1 +connection con1; +disconnect con1; +--source include/wait_until_disconnected.inc +--echo # Connection default +connection default; + +--echo # Test 5 - Different trace files +SET SESSION debug= '+O,../../log/bug46165.5.trace'; +SET SESSION debug= '+O,../../log/bug46165.6.trace'; +SET SESSION debug= '-O'; + +SET GLOBAL debug= @old_globaldebug; +SET SESSION debug= @old_sessiondebug; diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test index fe36af60c27..3fd243398a9 100644 --- a/mysql-test/t/xa.test +++ b/mysql-test/t/xa.test @@ -228,6 +228,23 @@ XA ROLLBACK 'xid1'; disconnect con1; DROP TABLE t1; + +--echo # +--echo # Bug#56448 Assertion failed: ! is_set() with second xa end +--echo # + +XA START 'x'; +XA END 'x'; +# Second XA END caused an assertion. +--error ER_XAER_RMFAIL +XA END 'x'; +XA PREPARE 'x'; +# Second XA PREPARE also caused an assertion. +--error ER_XAER_RMFAIL +XA PREPARE 'x'; +XA ROLLBACK 'x'; + + # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc |