diff options
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/alter_table.test | 27 | ||||
-rw-r--r-- | mysql-test/t/fulltext.test | 11 | ||||
-rw-r--r-- | mysql-test/t/fulltext_derived_4316.test | 14 | ||||
-rw-r--r-- | mysql-test/t/func_misc.test | 177 | ||||
-rw-r--r-- | mysql-test/t/mysqlbinlog.test | 4 | ||||
-rw-r--r-- | mysql-test/t/partition.test | 28 | ||||
-rw-r--r-- | mysql-test/t/quick_select_4161.test | 53 | ||||
-rw-r--r-- | mysql-test/t/subselect_sj.test | 9 | ||||
-rw-r--r-- | mysql-test/t/system_mysql_db_fix40123.test | 2 | ||||
-rw-r--r-- | mysql-test/t/system_mysql_db_fix50030.test | 2 | ||||
-rw-r--r-- | mysql-test/t/system_mysql_db_fix50117.test | 2 | ||||
-rw-r--r-- | mysql-test/t/xa_binlog.test | 4 |
12 files changed, 326 insertions, 7 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index eade7ba721e..d48b1687fa0 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1231,3 +1231,30 @@ execute stmt1; deallocate prepare stmt1; drop table t2; +# +# Test of ALTER TABLE IF [NOT] EXISTS +# + +CREATE TABLE t1 ( + id INT(11) NOT NULL, + x_param INT(11) DEFAULT NULL, + PRIMARY KEY (id) +); + +ALTER TABLE t1 ADD COLUMN IF NOT EXISTS id INT, + ADD COLUMN IF NOT EXISTS lol INT AFTER id; +ALTER TABLE t1 ADD COLUMN IF NOT EXISTS lol INT AFTER id; +ALTER TABLE t1 DROP COLUMN IF EXISTS lol; +ALTER TABLE t1 DROP COLUMN IF EXISTS lol; + +ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param); +ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param); +ALTER TABLE t1 MODIFY IF EXISTS lol INT; + +DROP INDEX IF EXISTS x_param ON t1; +DROP INDEX IF EXISTS x_param ON t1; +CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param); +CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param); +SHOW CREATE TABLE t1; +DROP TABLE t1; + diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index b4b09413896..6e44b4c1578 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -646,3 +646,14 @@ DEALLOCATE PREPARE stmt; DROP TABLE t1; --echo End of 5.1 tests + +CREATE TABLE t1 ( + id int(11) auto_increment, + title varchar(100) default '', + PRIMARY KEY (id), + KEY ind5 (title) +) ENGINE=MyISAM; + +CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title); +CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title); +DROP TABLE t1; diff --git a/mysql-test/t/fulltext_derived_4316.test b/mysql-test/t/fulltext_derived_4316.test new file mode 100644 index 00000000000..ecf4a0e7722 --- /dev/null +++ b/mysql-test/t/fulltext_derived_4316.test @@ -0,0 +1,14 @@ +# +# MATCH on the derived tables +# + +# +# MDEV-4316 MariaDB server crash with signal 11 +# + +create table t1 (ft text) engine=myisam; +insert into t1 values ('test1'),('test2'); +select distinct match(ft) against("test1" in boolean mode) from + (select distinct ft from t1) as t; +drop table t1; + diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index 292db69a6e3..22ebb6248e2 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -369,6 +369,183 @@ drop table t1,tv; --echo # +--echo # GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test +--echo # + +--echo # IS_USED_LOCK, IS_FREE_LOCK: the lock is not acquired +--echo # Note: IS_USED_LOCK returns NULL if the lock is unused +select is_used_lock('test'); +select is_free_lock('test'); + +--echo # GET_LOCK returns 1 if it manages to acquire a lock +select get_lock('test', 0); + +--echo # IS_USED_LOCK, IS_FREE_LOCK: the lock is acquired +select is_free_lock('test'); +select is_used_lock('test') = connection_id(); + +connect (con1,localhost,root,,); +--echo # -> Switching to connection 'con1' +connection con1; +--echo # IS_USED_LOCK, IS_FREE_LOCK: the lock is acquired in another +--echo # connection +select is_used_lock('test') = connection_id(); +select is_free_lock('test'); + +--echo # GET_LOCK returns 0 if it can't acquire a lock (wait timeout) +select get_lock('test', 0); + +--echo # RELEASE_LOCK returns 0 if the lock belongs to another connection +select release_lock('test'); + +--echo # -> Switching to connection 'default' +connection default; + +--echo # RELEASE_LOCK returns 1 if it successfully releases a lock +select release_lock('test'); +--echo # RELEASE_LOCK returns NULL if it doesn't release a lock and there is no such lock +select release_lock('test'); + +--echo # Test that get_lock() returns NULL if error. +select get_lock('test', 0); +--echo # -> Switching to connection 'con1' +connection con1; +create table t1 select connection_id() as id; +send select get_lock('test', 7200); + +--echo # -> Switching to connection 'default' +connection default; +let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE info LIKE 'select%' AND state='User lock'; +source include/wait_condition.inc; +select (@id := id) - id from t1; +kill query @id; + +--echo # -> Switching to connection 'con1' +connection con1; +reap; + +--echo # -> Switching to connection 'default' +connection default; + +--echo # GET_LOCK() works recursively +select get_lock('test', 0); +select get_lock('test', 0); +select get_lock('test', 0); + +--echo # RELEASE_LOCK() needs to be called recursively then, too +select release_lock('test'); +select release_lock('test'); +select release_lock('test'); + +--echo # Once the last instance of the lock is released, +--echo # the next call returns NULL +select release_lock('test'); + + +--echo # Multiple locks in the same session are OK +select get_lock('test1', 0); +select get_lock('test2', 0); +select get_lock('test3', 0); + +select release_lock('test1'); +select release_lock('test2'); +select release_lock('test3'); + +--echo # Deadlocks are detected e.g. in case of a mutual wait +select get_lock('test1', 0); + +--echo # -> Switching to connection 'con1' +connection con1; +select get_lock('test2', 0); +send select get_lock('test1', 7200); + +--echo # -> Switching to connection 'default' +connection default; +let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE info LIKE 'select%' AND state='User lock'; +source include/wait_condition.inc; +--error ER_LOCK_DEADLOCK +select get_lock('test2', 7200); + +select release_lock('test1'); + +--echo # -> Switching to connection 'con1' +connection con1; +reap; +select release_lock('test2'); +select release_lock('test1'); + +--echo # -> Switching to connection 'default' +connection default; + +--echo # LOCK/UNLOCK TABLES works fine with a user lock. +lock table t1 write; +select get_lock('test', 0); +unlock tables; +commit; +select release_lock('test'); + +--echo # GLOBAL READ LOCK works with fine with user locks +select get_lock('test1', 0); +flush tables with read lock; +select get_lock('test2', 0); +unlock tables; +commit; +select release_lock('test1'); +select release_lock('test2'); + +--echo # BEGIN/COMMIT/ROLLBACK don't unlock user locks. +begin; +select get_lock('test1', 0); +select get_lock('test2', 0); +select count(*) from t1; +rollback; +select release_lock('test1'); +select release_lock('test2'); + +--echo # Deadlocks between user locks and LOCK TABLES locks +--echo # are detected OK. +select get_lock('test', 0); + +--echo # -> Switching to connection 'con1' +connection con1; +lock table t1 write; +send select get_lock('test', 7200); + +--echo # -> Switching to connection 'default' +connection default; +let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE info LIKE 'select%' AND state = 'User lock'; +source include/wait_condition.inc; +--error ER_LOCK_DEADLOCK +lock table t1 read; + +select release_lock('test'); + +--echo # -> Switching to connection 'con1' +connection con1; +reap; +select release_lock('test'); +unlock tables; + +--echo # cleanup +disconnect con1; +connection default; +drop table t1; + +--echo # check too long identifier names +select get_lock(repeat('a', 192), 0); +select is_used_lock(repeat('a', 192)) = connection_id(); +select is_free_lock(repeat('a', 192)); +select release_lock(repeat('a', 192)); +--error ER_TOO_LONG_IDENT +select get_lock(repeat('a', 193), 0); +--error ER_TOO_LONG_IDENT +select is_used_lock(repeat('a', 193)); +--error ER_TOO_LONG_IDENT +select is_free_lock(repeat('a', 193)); +--error ER_TOO_LONG_IDENT +select release_lock(repeat('a', 193)); + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index e8ce861dd53..96b18be8c37 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -289,11 +289,11 @@ eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat' --remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat --enable_query_log ---echo We expect this value to be 1 +--echo We expect this value to be 2 (one for the INSERT, one for COMMIT). --echo The bug being tested was that 'Query' lines were not preceded by '#' --echo If the line is in the table, it had to have been preceded by a '#' --echo -SELECT COUNT(*) AS `BUG#28293_expect_3` FROM patch WHERE a LIKE '%Query%'; +SELECT COUNT(*) AS `BUG#28293_expect_2` FROM patch WHERE a LIKE '%Query%'; DROP TABLE patch; # diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 038907702d5..bad59ff09c3 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -2494,3 +2494,31 @@ INSERT INTO t1 VALUES (1),(2),(2),(3),(4); ALTER TABLE t1 ADD PARTITION PARTITIONS 2; SELECT * from t1 order by i; DROP TABLE t1; + +# +# Test ALTER TABLE ADD/DROP PARTITION IF EXISTS +# + +CREATE TABLE t1 ( d DATE NOT NULL) +PARTITION BY RANGE( YEAR(d) ) ( + PARTITION p0 VALUES LESS THAN (1960), + PARTITION p1 VALUES LESS THAN (1970), + PARTITION p2 VALUES LESS THAN (1980), + PARTITION p3 VALUES LESS THAN (1990) +); + +ALTER TABLE t1 ADD PARTITION IF NOT EXISTS( +PARTITION `p5` VALUES LESS THAN (2010) +COMMENT 'APSTART \' APEND' +); + +ALTER TABLE t1 ADD PARTITION IF NOT EXISTS( +PARTITION `p5` VALUES LESS THAN (2010) +COMMENT 'APSTART \' APEND' +); + +alter table t1 drop partition if exists p5; +alter table t1 drop partition if exists p5; + +DROP TABLE t1; + diff --git a/mysql-test/t/quick_select_4161.test b/mysql-test/t/quick_select_4161.test new file mode 100644 index 00000000000..1e746754b41 --- /dev/null +++ b/mysql-test/t/quick_select_4161.test @@ -0,0 +1,53 @@ +# +# MDEV-4161 Assertion `status_var.memory_used == 0' fails in virtual THD::~THD() +# +--source include/have_debug_sync.inc + +CREATE TABLE t1 ( + event_date date DEFAULT '0000-00-00' NOT NULL, + type int(11) DEFAULT '0' NOT NULL, + event_id int(11) DEFAULT '0' NOT NULL, + PRIMARY KEY (event_date,type,event_id) +); + +INSERT INTO t1 VALUES ('1999-07-10',100100,24), ('1999-07-11',100100,25), +('1999-07-13',100600,0), ('1999-07-13',100600,4), ('1999-07-13',100600,26), +('1999-07-14',100600,10), ('1999-07-15',100600,16), ('1999-07-15',100800,45), +('1999-07-15',101000,47), ('1999-07-16',100800,46), ('1999-07-20',100600,5), +('1999-07-20',100600,27), ('1999-07-21',100600,11), ('1999-07-22',100600,17), +('1999-07-23',100100,39), ('1999-07-24',100100,39), ('1999-07-24',100500,40), +('1999-07-25',100100,39), ('1999-07-27',100600,1), ('1999-07-27',100600,6), +('1999-07-27',100600,28), ('1999-07-28',100600,12), ('1999-07-29',100500,41), +('1999-07-29',100600,18), ('1999-07-30',100500,41), ('1999-07-31',100500,41), +('1999-08-01',100700,34), ('1999-08-03',100600,7), ('1999-08-03',100600,29), +('1999-08-04',100600,13), ('1999-08-05',100500,42), ('1999-08-05',100600,19), +('1999-08-06',100500,42), ('1999-08-07',100500,42), ('1999-08-08',100500,42), +('1999-08-10',100600,2), ('1999-08-10',100600,9), ('1999-08-10',100600,30), +('1999-08-11',100600,14), ('1999-08-12',100600,20), ('1999-08-17',100500,8), +('1999-08-17',100600,31), ('1999-08-18',100600,15), ('1999-08-19',100600,22), +('1999-08-24',100600,3), ('1999-08-24',100600,32), ('1999-08-27',100500,43), +('1999-08-31',100600,33), ('1999-09-17',100100,37), ('1999-09-18',100100,37), +('1999-09-19',100100,37), ('2000-12-18',100700,38); + +connect (killee, localhost, root); + +let $id=`select connection_id()`; + +set debug_sync='inside_make_join_statistics signal killme wait_for done'; +send select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date; + +connection default; +set debug_sync='now wait_for killme'; +--replace_result $id %connection% +eval kill $id; +set debug_sync='now signal done'; + +connection killee; +--error 1053,1927,2006,2013 +reap; + +connection default; +disconnect killee; + +drop table t1; + diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test index efbd2b00f24..e2abb8040b3 100644 --- a/mysql-test/t/subselect_sj.test +++ b/mysql-test/t/subselect_sj.test @@ -2482,6 +2482,15 @@ deallocate prepare stmt; drop table t1,t2; --echo # +--echo # MDEV-4335: Unexpected results when selecting on information_schema +--echo # +CREATE TABLE t1 (db VARCHAR(64) DEFAULT NULL); +INSERT INTO t1 VALUES ('mysql'),('information_schema'); +SELECT * FROM t1 WHERE db IN (SELECT `SCHEMA_NAME` FROM information_schema.SCHEMATA); +DROP TABLE t1; + + +--echo # --echo # MySQL Bug#13340270: assertion table->sort.record_pointers == __null --echo # diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test index 15e182f778f..d013ca5d0d9 100644 --- a/mysql-test/t/system_mysql_db_fix40123.test +++ b/mysql-test/t/system_mysql_db_fix40123.test @@ -77,7 +77,7 @@ CREATE TABLE index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) N -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stats, column_stats, index_stats; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, rpl_slave_state, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stats, column_stats, index_stats; -- enable_query_log diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test index bf7a6ec2d93..26eceec96dc 100644 --- a/mysql-test/t/system_mysql_db_fix50030.test +++ b/mysql-test/t/system_mysql_db_fix50030.test @@ -84,7 +84,7 @@ CREATE TABLE index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) N -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stats, column_stats, index_stats; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, rpl_slave_state, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stats, column_stats, index_stats; -- enable_query_log diff --git a/mysql-test/t/system_mysql_db_fix50117.test b/mysql-test/t/system_mysql_db_fix50117.test index 8090b43a850..9e5ffb8c2cb 100644 --- a/mysql-test/t/system_mysql_db_fix50117.test +++ b/mysql-test/t/system_mysql_db_fix50117.test @@ -103,7 +103,7 @@ CREATE TABLE index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) N -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stats, column_stats, index_stats; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, rpl_slave_state, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stats, column_stats, index_stats; -- enable_query_log diff --git a/mysql-test/t/xa_binlog.test b/mysql-test/t/xa_binlog.test index 430d45ab86a..ecbf1f4f066 100644 --- a/mysql-test/t/xa_binlog.test +++ b/mysql-test/t/xa_binlog.test @@ -26,7 +26,7 @@ COMMIT; SELECT * FROM t1 ORDER BY a; --replace_column 2 # 5 # ---replace_regex /xid=[0-9]+/xid=XX/ -SHOW BINLOG EVENTS LIMIT 2,9; +--replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ +SHOW BINLOG EVENTS LIMIT 3,9; DROP TABLE t1; |