diff options
Diffstat (limited to 'mysql-test/t')
49 files changed, 1787 insertions, 1102 deletions
diff --git a/mysql-test/t/alias.test b/mysql-test/t/alias.test index 0e2d57598e2..c02ebe2f5ff 100644 --- a/mysql-test/t/alias.test +++ b/mysql-test/t/alias.test @@ -215,3 +215,14 @@ drop table t4; drop table t1,t2,t3; # End of 5.2 tests + +# +# MDEV-3908 crash in multi-table delete and mdl +# +connect (c1,localhost,root,,); +connection c1; +# this used to crash on disconnect +--error ER_PARSE_ERROR +DELETE ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ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ZZZZZZZZZZZZZZZZZZZZZZZZROM t1 WHERE 1=1; +connection default; +disconnect c1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test new file mode 100644 index 00000000000..2b92956d974 --- /dev/null +++ b/mysql-test/t/cassandra.test @@ -0,0 +1,719 @@ +# +# Tests for cassandra storage engine +# +--source include/have_cassandra.inc + +--disable_warnings +drop table if exists t0, t1; +--enable_warnings + +# Test various errors on table creation. +--error ER_REQUIRES_PRIMARY_KEY +create table t1 (a int) engine=cassandra + thrift_host='localhost' keyspace='foo' column_family='colfam'; + +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +create table t1 (a int primary key, b int) engine=cassandra + thrift_host='localhost' keyspace='foo' column_family='colfam'; + +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra + thrift_host='127.0.0.2' keyspace='foo' column_family='colfam'; + +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra + thrift_host='localhost' keyspace='no_such_keyspace' column_family='colfam'; + +# No column family specified +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra + thrift_host='localhost' keyspace='no_such_keyspace'; + +############################################################################ +## Cassandra initialization +############################################################################ + +# Step 1: remove the keyspace that could be left over from the previous test +--remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_cleanup.cql +--write_file $MYSQLTEST_VARDIR/cassandra_test_cleanup.cql +drop keyspace mariadbtest2; +EOF +--error 0,1,2 +--system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_cleanup.cql + +# Step 2: create new keyspace and test column families +--remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_init.cql +--write_file $MYSQLTEST_VARDIR/cassandra_test_init.cql + +CREATE KEYSPACE mariadbtest2 + WITH strategy_class = 'org.apache.cassandra.locator.SimpleStrategy' + AND strategy_options:replication_factor='1'; + +USE mariadbtest2; +create columnfamily cf1 ( pk varchar primary key, data1 varchar, data2 bigint); + +create columnfamily cf2 (rowkey bigint primary key, a bigint); + +create columnfamily cf3 (rowkey bigint primary key, intcol int); + +create columnfamily cf4 (rowkey bigint primary key, datecol timestamp); + +create columnfamily cf5 (rowkey bigint primary key, uuidcol uuid); + +create columnfamily cf6 (rowkey uuid primary key, col1 int); + +create columnfamily cf7 (rowkey int primary key, boolcol boolean); + +create columnfamily cf8 (rowkey varchar primary key, countercol counter); +update cf8 set countercol=countercol+1 where rowkey='cnt1'; +update cf8 set countercol=countercol+100 where rowkey='cnt2'; + +create columnfamily cf9 (rowkey varchar primary key, varint_col varint); +insert into cf9 (rowkey, varint_col) values ('val-01', 1); +insert into cf9 (rowkey, varint_col) values ('val-0x123456', 1193046); +insert into cf9 (rowkey, varint_col) values ('val-0x12345678', 305419896); + +create columnfamily cf11 (rowkey varchar primary key, decimal_col decimal); +insert into cf11 (rowkey, decimal_col) values ('val_0.5', 0.5); +insert into cf11 (rowkey, decimal_col) values ('val_1.5', 1.5); +insert into cf11 (rowkey, decimal_col) values ('val_1234', 1234); + +create columnfamily cf12 (rowkey varchar primary key, decimal_col decimal); + +EOF +--error 0,1,2 +--system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_init.cql + + +# Step 3: Cassandra's CQL doesn't allow certain kinds of queries. Run them in +# CLI +--remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_init.cli +--write_file $MYSQLTEST_VARDIR/cassandra_test_init.cli +use mariadbtest2; +CREATE COLUMN FAMILY cf10 + WITH comparator = UTF8Type + AND key_validation_class=UTF8Type + AND default_validation_class = UTF8Type; + +CREATE COLUMN FAMILY cfd1 + WITH comparator = UTF8Type + AND key_validation_class=UTF8Type + AND default_validation_class = UTF8Type; +SET cfd1['1']['very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_name']='1'; + +CREATE COLUMN FAMILY cfd2 + WITH comparator = UTF8Type + AND key_validation_class=Int32Type + AND default_validation_class = UTF8Type; + +EOF + +--error 0,1,2 +--system cassandra-cli -f $MYSQLTEST_VARDIR/cassandra_test_init.cli + +############################################################################ +## Cassandra initialization ends +############################################################################ + +--echo # Now, create a table for real and insert data +create table t1 (pk varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra + thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; + +--echo # Just in case there were left-overs from previous: +delete from t1; +select * from t1; + +insert into t1 values ('rowkey10', 'data1-value', 123456); +insert into t1 values ('rowkey11', 'data1-value2', 34543); +insert into t1 values ('rowkey12', 'data1-value3', 454); +select * from t1; + +explain +select * from t1 where pk='rowkey11'; +select * from t1 where pk='rowkey11'; + +# Deletion functions weirdly: it sets all columns to NULL +# but when If I do this in cassandra-cli: +# +# del cf1[ascii('rowkey10')] +# +# Subsequent 'list cf1' command also gives +# +# RowKey: rowkey10 +# +# without any columns. +# +# CQL seems to simply ignore all "incomplete" records. + +delete from t1 where pk='rowkey11'; +select * from t1; + +delete from t1; +select * from t1; + +--echo # +--echo # A query with filesort (check that table_flags() & HA_REC_NOT_IN_SEQ, +--echo # also check ::rnd_pos() +--echo # +insert into t1 values ('rowkey10', 'data1-value', 123456); +insert into t1 values ('rowkey11', 'data1-value2', 34543); +insert into t1 values ('rowkey12', 'data1-value3', 454); +select * from t1 order by data2; + +delete from t1; +drop table t1; + +--echo # +--echo # MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY +--echo # +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; + +INSERT INTO t1 VALUES (1,1),(2,2); +DELETE FROM t1 ORDER BY a LIMIT 1; + +DROP TABLE t1; + +--echo # +--echo # Batched INSERT +--echo # +show variables like 'cassandra_insert_batch_size'; +show status like 'cassandra_row_insert%'; +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; + +delete from t1; +INSERT INTO t1 VALUES (1,1),(2,2); +DELETE FROM t1 ORDER BY a LIMIT 1; + +DROP TABLE t1; +show status like 'cassandra_row_insert%'; + +--echo # FLUSH STATUS doesn't work for our variables, just like with InnoDB. +flush status; +show status like 'cassandra_row_insert%'; + +--echo # +--echo # Batched Key Access +--echo # + +--echo # Control variable (we are not yet able to make use of MRR's buffer) +show variables like 'cassandra_multi%'; + +--echo # MRR-related status variables: +show status like 'cassandra_multi%'; + +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +delete from t1; +INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); + +set @tmp_jcl=@@join_cache_level; +set join_cache_level=8; +explain select * from t1 A, t1 B where B.rowkey=A.a; + +select * from t1 A, t1 B where B.rowkey=A.a; +show status like 'cassandra_multi%'; + +# The following INSERTs are really UPDATEs +insert into t1 values(1, 8); +insert into t1 values(3, 8); +insert into t1 values(5, 8); +insert into t1 values(7, 8); + +select * from t1 A, t1 B where B.rowkey=A.a; +show status like 'cassandra_multi%'; + +delete from t1; +drop table t1; + +--echo # +--echo # MDEV-480: TRUNCATE TABLE on a Cassandra table does not remove rows +--echo # +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +INSERT INTO t1 VALUES (0,0),(1,1),(2,2); +truncate table t1; +select * from t1; +drop table t1; + +--echo # +--echo # MDEV-494, part #1: phantom row for big full-scan selects +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; + +insert into t1 select A.a + 10 * B.a + 100*C.a, 12345 from t0 A, t0 B, t0 C; + +select count(*) from t1; +select count(*) from t1 where a=12345; + +delete from t1; +drop table t1; +drop table t0; + +--echo # 32-bit INT type support +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, intcol INT) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf3'; +insert into t1 values (10,10); +insert into t1 values (12,12); +delete from t1; +drop table t1; + +--echo # +--echo # Try accessing column family w/o explicitly defined columns +--echo # +--error ER_INTERNAL_ERROR +CREATE TABLE t1 (my_primary_key varchar(10) PRIMARY KEY) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf10'; + +CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf10'; + +DROP TABLE t1; + +--echo # +--echo # Timestamp datatype support +--echo # +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol timestamp) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; + +delete from t2; +insert into t2 values (1, '2012-08-29 01:23:45'); +select * from t2; +delete from t2; + +--echo # MDEV-498: Cassandra: Inserting a timestamp does not work on a 32-bit system +INSERT INTO t2 VALUES (10,'2012-12-12 12:12:12'); +SELECT * FROM t2; +delete from t2; + +--echo # +--echo # (no MDEV#) Check that insert counters work correctly +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +let $start_inserts=`select variable_value from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_inserts'`; +let $start_insert_batches=`select variable_value from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_insert_batches'`; + +set cassandra_insert_batch_size=10; +insert into t2 select A.a+10*B.a, now() from t0 A, t0 B; + +--disable_query_log +eval select + (select variable_value - $start_inserts from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_inserts') + AS 'inserts', + (select variable_value - $start_insert_batches from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_insert_batches') + AS 'insert_batches'; +--enable_query_log + +let $start_inserts=`select variable_value from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_inserts'`; +let $start_insert_batches=`select variable_value from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_insert_batches'`; + +set cassandra_insert_batch_size=1; +insert into t2 select A.a+10*B.a+100, now() from t0 A, t0 B; + +--disable_query_log +eval select + (select variable_value - $start_inserts from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_inserts') + AS 'inserts', + (select variable_value - $start_insert_batches from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_insert_batches') + AS 'insert_batches'; +--enable_query_log + +delete from t2; +drop table t2; +drop table t0; + +--echo # +--echo # UUID datatype support +--echo # +#create columnfamily cf5 (rowkey bigint primary key, uuidcol uuid); +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +delete from t2; + +insert into t2 values(1,'9b5658dc-f32f-11e1-94cd-f46d046e9f09'); + +--error ER_WARN_DATA_OUT_OF_RANGE +insert into t2 values(2,'not-an-uuid'); + +--error ER_WARN_DATA_OUT_OF_RANGE +insert into t2 values(3,'9b5658dc-f32f-11e1=94cd-f46d046e9f09'); + +--error ER_WARN_DATA_OUT_OF_RANGE +insert into t2 values(4,'9b5658dc-fzzf-11e1-94cd-f46d046e9f09'); + +--error ER_WARN_DATA_OUT_OF_RANGE +insert into t2 values + (5,'9b5658dc-f11f-11e1-94cd-f46d046e9f09'), + (6,'9b5658dc-f11f011e1-94cd-f46d046e9f09'); + +select * from t2; + +delete from t2; +drop table t2; + +# create columnfamily cf6 (rowkey uuid primary key, col1 int); +CREATE TABLE t2 (rowkey char(36) PRIMARY KEY, col1 int) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf6'; +delete from t2; + +insert into t2 values('9b5658dc-f32f-11e1-94cd-f46d046e9f09', 1234); + +--error ER_WARN_DATA_OUT_OF_RANGE +insert into t2 values('not-an-uuid', 563); + +select * from t2; +delete from t2; +drop table t2; + + +--echo # +--echo # boolean datatype support +--echo # +# create columnfamily cf7 (rowkey int primary key, boolcol boolean); +CREATE TABLE t2 (rowkey int PRIMARY KEY, boolcol bool) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7'; +insert into t2 values (0, 0); +insert into t2 values (1, 1); +select * from t2; +delete from t2; +drop table t2; + + +--echo # +--echo # Counter datatype support (read-only) +--echo # +# create columnfamily cf8 (rowkey int primary key, countercol counter); +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf8'; +select * from t2; +drop table t2; + +--echo # +--echo # Check that @@cassandra_default_thrift_host works +--echo # +show variables like 'cassandra_default_thrift_host'; +set @tmp=@@cassandra_default_thrift_host; +--error ER_GLOBAL_VARIABLE +set cassandra_default_thrift_host='localhost'; +set global cassandra_default_thrift_host='localhost'; + +--echo # Try creating a table without specifying thrift_host: +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA + keyspace='mariadbtest2' column_family = 'cf8'; +select * from t2; +drop table t2; + +set global cassandra_default_thrift_host=@tmp; + +--echo # +--echo # Consistency settings +--echo # +show variables like 'cassandra_%consistency'; +set @tmp=@@cassandra_write_consistency; + +--echo # Unfortunately, there is no easy way to check if setting have the effect.. +set cassandra_write_consistency='ONE'; +set cassandra_write_consistency='QUORUM'; +set cassandra_write_consistency='LOCAL_QUORUM'; +set cassandra_write_consistency='EACH_QUORUM'; +set cassandra_write_consistency='ALL'; +set cassandra_write_consistency='ANY'; +set cassandra_write_consistency='TWO'; +set cassandra_write_consistency='THREE'; + +set cassandra_write_consistency=@tmp; + +--echo # +--echo # varint datatype support +--echo # +# create columnfamily cf9 (rowkey varchar primary key, varint_col varint); +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, varint_col varbinary(32)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf9'; +--sorted_result +select rowkey, hex(varint_col) from t2; +drop table t2; + +--echo # now, let's check what happens when MariaDB's column is not wide enough: +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, varint_col varbinary(2)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf9'; +--sorted_result +--error ER_INTERNAL_ERROR +select rowkey, hex(varint_col) from t2; +drop table t2; + +--echo # +--echo # Decimal datatype support +--echo # +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11'; +select rowkey, hex(decimal_col) from t2; +drop table t2; + +--echo # +--echo # Mapping TIMESTAMP -> int64 +--echo # +set @save_tz= @@time_zone; +set time_zone='UTC'; +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol timestamp) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; +insert into t2 values (1, '2012-08-29 01:23:45'); +INSERT INTO t2 VALUES (10,'2012-08-29 01:23:46'); +drop table t2; + +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol bigint) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; +select * from t2; +delete from t2; +drop table t2; +set time_zone=@save_tz; + +--echo # +--echo # Check whether changing parameters with ALTER TABLE works. +--echo # +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11'; + +#--error ER_INTERNAL_ERROR +#alter table t2 column_family='cf9'; + +drop table t2; + +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11'; + +let $c1= `select variable_value from information_schema.global_status + where variable_name like 'cassandra_row_inserts'`; +alter table t2 column_family='cf12'; +let $c2= `select variable_value from information_schema.global_status + where variable_name like 'cassandra_row_inserts'`; + +--disable_query_log +eval select ($c2 - $c1) as 'Writes made during ALTER TABLE'; +--enable_query_log + +drop table t2; + +--echo # +--echo # UPDATE command support +--echo # +create table t1 (pk varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra + thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; + +insert into t1 values ('rowkey10', 'data1-value', 123456); +insert into t1 values ('rowkey11', 'data1-value2', 34543); +insert into t1 values ('rowkey12', 'data1-value3', 454); +select * from t1; + +update t1 set data1='updated-1' where pk='rowkey11'; +select * from t1; +update t1 set pk='new-rowkey12' where pk='rowkey12'; +select * from t1; + +delete from t1; +drop table t1; + +--echo # +--echo # Dynamic columns support +--echo # +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol blob DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +drop table t2; + +--echo #error: dynamic column is not a blob +--error ER_WRONG_FIELD_SPEC +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36) DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; + +--echo #error: double dynamic column +--error ER_WRONG_FIELD_SPEC +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol blob DYNAMIC_COLUMN_STORAGE=1, textcol blob DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; + +--echo # +--echo # Dynamic column read +--echo # +#prepare data +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +delete from t2; +insert into t2 values(1,'9b5658dc-f32f-11e1-94cd-f46d046e9f09'); +insert into t2 values(2,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a'); +drop table t2; + +#test dynamic column read +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +select rowkey, column_list(dyn), column_get(dyn, 'uuidcol' as char) from t2; +drop table t2; + +#cleanup data +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +delete from t2; +drop table t2; + +--echo # +--echo # Dynamic column insert +--echo # +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +insert into t2 values (1, column_create("dyn1", 1, "dyn2", "two")); +select rowkey, column_json(dyn) from t2; +delete from t2; +drop table t2; +--echo # bigint +CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'a', 254324)); +insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'a', 2543)); +select rowkey, column_json(dyn) from t1; +delete from t1; +drop table t1; +--echo # int +CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf3'; +insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'intcol', 254324)); +insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'intcol', 2543)); +select rowkey, column_json(dyn) from t1; +delete from t1; +drop table t1; +--echo # timestamp +CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; +insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'datecol', 254324)); +insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'datecol', 2543)); +select rowkey, column_json(dyn) from t1; +delete from t1; +drop table t1; +--echo # boolean +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7'; +insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'boolcol', 254324)); +insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'boolcol', 0)); +select rowkey, column_json(dyn) from t1; +select rowkey, column_json(dyn) from t1; +update t1 set dyn=column_add(dyn, "dyn2", null, "dyn3", "3"); +select rowkey, column_json(dyn) from t1; +update t1 set dyn=column_add(dyn, "dyn1", null) where rowkey= 1; +select rowkey, column_json(dyn) from t1; +update t1 set dyn=column_add(dyn, "dyn3", null, "a", "ddd"); +select rowkey, column_json(dyn) from t1; +update t1 set dyn=column_add(dyn, "12345678901234", "ddd"); +select rowkey, column_json(dyn) from t1; +update t1 set dyn=column_add(dyn, "12345678901234", null); +select rowkey, column_json(dyn) from t1; +update t1 set dyn=column_add(dyn, 'boolcol', null) where rowkey= 2; +select rowkey, column_json(dyn) from t1; +update t1 set rowkey= 3, dyn=column_add(dyn, "dyn1", null, 'boolcol', 0) where rowkey= 2; +select rowkey, column_json(dyn) from t1; +delete from t1; +drop table t1; + +CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd1'; +--error ER_INTERNAL_ERROR +select * from t1; +drop table t1; + +# MDEV-560 +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) +ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; +DELETE FROM t1; +insert into t1 values (1, column_create("dyn", 1)); +select rowkey, column_list(dyn) from t1; +# Cleanup +delete from t1; +DROP TABLE t1; + +# MDEV-561 (incorrect format data to dynamic column) +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) +ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; +--error ER_DYN_COL_WRONG_FORMAT +insert into t1 values (1,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a'); +delete from t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-565: Server crashes in ha_cassandra::write_row on +--echo # inserting NULL into a dynamic column +--echo # +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) +ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; +insert into t1 values (1, NULL); +delete from t1; +DROP TABLE t1; + +--echo # +--echo # strange side effect of Cassandra - remiving all columns of primary +--echo # key removes all row. +--echo # +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) +ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; +INSERT INTO t1 VALUES(2,column_create("ab","ab")); +select rowkey, column_json(dyn) from t1; +UPDATE t1 set dyn=NULL; +select rowkey, column_json(dyn) from t1; +INSERT INTO t1 VALUES(2,column_create("ab","ab")); +select rowkey, column_json(dyn) from t1; +UPDATE t1 set dyn=""; +select rowkey, column_json(dyn) from t1; +delete from t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-4005 #Server crashes on creating a Cassandra table +--echo # with a mix of static and dynamic columns +--echo # +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +--remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_cleanup.cql +--write_file $MYSQLTEST_VARDIR/cassandra_test_cleanup.cql +drop keyspace bug; +EOF +--error 0,1,2 +--system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_cleanup.cql + +--remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_init.cql +--write_file $MYSQLTEST_VARDIR/cassandra_test_init.cql + +CREATE KEYSPACE bug + WITH strategy_class = 'org.apache.cassandra.locator.SimpleStrategy' + AND strategy_options:replication_factor='1'; + +USE bug; +create columnfamily cf1 ( pk int primary key, col_int int, a bigint ); +EOF + +--system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_init.cql + + +CREATE TABLE t1 ( + pk int primary key, + col_int int, + dyncol blob DYNAMIC_COLUMN_STORAGE=yes +) ENGINE=cassandra keyspace='bug' thrift_host = '127.0.0.1' column_family='cf1'; + +drop table t1; + +############################################################################ +## Cassandra cleanup +############################################################################ +--disable_parsing +drop columnfamily cf1; +drop columnfamily cf2; +drop columnfamily cf3; +drop columnfamily cf4; +drop columnfamily cf5; +drop columnfamily cf6; +drop columnfamily cf7; +--enable_parsing +############################################################################ +## Cassandra cleanup ends +############################################################################ + diff --git a/mysql-test/t/change_user_notembedded.test b/mysql-test/t/change_user_notembedded.test new file mode 100644 index 00000000000..bf5d1956cd5 --- /dev/null +++ b/mysql-test/t/change_user_notembedded.test @@ -0,0 +1,24 @@ +source include/not_embedded.inc; + +# +# MDEV-3915 COM_CHANGE_USER allows fast password brute-forcing +# +# only three failed change_user per connection. +# successful change_user do NOT reset the counter +# +connect (test,localhost,root,,); +connection test; +--error 1045 +change_user foo,bar; +--error 1045 +change_user foo; +change_user; +--error 1045 +change_user foo,bar; +--error 1047 +change_user foo,bar; +--error 1047 +change_user; +disconnect test; +connection default; + diff --git a/mysql-test/t/create_delayed.test b/mysql-test/t/create_delayed.test new file mode 100644 index 00000000000..e99886d97d1 --- /dev/null +++ b/mysql-test/t/create_delayed.test @@ -0,0 +1,34 @@ +# +# Ensure that INSERT DELAYED works with CREATE TABLE on existing table +# + +-- source include/big_test.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +--disable_query_log +--disable_result_log + +--let $run=1000 + +--echo Starting test + +while ($run) +{ +# --echo # $run attempts left... + CREATE TABLE t1 ( f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1)) ENGINE=MyISAM; + INSERT DELAYED t1 VALUES (4); +--error ER_TABLE_EXISTS_ERROR + CREATE TABLE t1 AS SELECT 1 AS f1; + + REPLACE DELAYED t1 VALUES (5); + DROP TABLE t1; +--dec $run +} + +--enable_query_log +--enable_result_log + +--echo # All done diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index f3557e36a58..9f5b4153bce 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -68,6 +68,38 @@ RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r; SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # Bug #51876 : crash/memory underrun when loading data with ucs2 +--echo # and reverse() function +--echo # + +--echo # Problem # 1 (original report): wrong parsing of ucs2 data +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +--echo # should return 2 zeroes (as the value is truncated) +SELECT * FROM t1; + +DROP TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/tmpp.txt; + + +--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +--echo # should return 0 and 1 (10 reversed) +SELECT * FROM t1; + +DROP TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/tmpp2.txt; + + + # # BUG3946 # diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index 847e302e615..f42d30e1f00 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -777,6 +777,10 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1 GROUP BY id ORDER BY l DESC; +SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l +FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body +UNION ALL +SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1; # ## TODO: add tests for all engines diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 210589adc81..0b90f222593 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1590,6 +1590,11 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1 GROUP BY id ORDER BY l DESC; +SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l +FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body +UNION ALL +SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1; + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test index 30811be2934..c7705294ef2 100644 --- a/mysql-test/t/derived_view.test +++ b/mysql-test/t/derived_view.test @@ -1451,6 +1451,67 @@ select * from t1; drop table t1,t2; --echo # +--echo # MDEV-3873: Wrong result (extra rows) with NOT IN and +--echo # a subquery from a MERGE view +--echo # + +CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4),(7),(0); + +CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); + +CREATE TABLE t3 (c INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t3 VALUES (4),(6),(3); + +CREATE TABLE t4 (d INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t4 VALUES (4),(5),(3); + +CREATE TABLE tv (e INT NOT NULL) ENGINE=MyISAM; +INSERT INTO tv VALUES (1),(3); + +CREATE ALGORITHM=TEMPTABLE VIEW v_temptable AS SELECT * FROM tv; +CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv; + +SELECT * FROM t1, t2 +WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_temptable ON (c = e) WHERE c <> b ) AND a < b; + +SELECT * FROM t1, t2 +WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_merge ON (c = e) WHERE c <> b ) AND a < b; + +SELECT * FROM t1, t2 +WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN (SELECT * FROM tv) as derived ON (c = e) WHERE c <> b ) AND a < b; + +drop view v_temptable, v_merge; +drop table t1,t2,t3,t4,tv; + +--echo # +--echo # MDEV-3912: Wrong result (extra rows) with FROM subquery inside +--echo # ALL subquery, LEFT JOIN, derived_merge. +--echo # (duplicate of MDEV-3873 (above)) +--echo # + +SET @save3912_optimizer_switch=@@optimizer_switch; +SET optimizer_switch = 'derived_merge=on,in_to_exists=on'; + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4),(8); + +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (7),(0); + +CREATE TABLE t3 (c INT, d INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t3 VALUES (0,4),(8,6); + +SELECT * FROM t1 +WHERE a >= ALL ( +SELECT d FROM t2 LEFT JOIN ( SELECT * FROM t3 ) AS alias ON ( c = b ) +WHERE b >= a +); +set optimizer_switch=@save3912_optimizer_switch; +drop table t1, t2, t3; + +--echo # --echo # end of 5.3 tests --echo # diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index 051499f465b..f1c120a313d 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -658,6 +658,31 @@ select time(f1) from t1 ; select distinct time(f1) from t1 ; drop table t1; +# +# MDEV-3875 Wrong result (missing row) on a DISTINCT query with the same subquery in the SELECT list and GROUP BY +# MySQL Bug#66896 Distinct not distinguishing 0 from NULL when GROUP BY is used +# +create table t1(i int, g int); # remove_dup_with_hash_index +insert into t1 values (null, 1), (0, 2); +select distinct i from t1 group by g; +drop table t1; + +create table t1(i int, g blob); # remove_dup_with_compare +insert into t1 values (null, 1), (0, 2); +select distinct i from t1 group by g; +drop table t1; + +create table t1 (a int) engine=myisam; +insert into t1 values (0),(7); +create table t2 (b int) engine=myisam; +insert into t2 values (7),(0),(3); +create algorithm=temptable view v as +select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1; +select * from v; +select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1; +drop view v; +drop table t1, t2; + --echo # --echo # Bug #11744875: 4082: integer lengths cause truncation with distinct concat and innodb --echo # diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index 66e308540f4..de30cac610a 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -550,3 +550,164 @@ select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL(19,0)))); select hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal))); select hex(COLUMN_CREATE(0, 0.0 as decimal)); + +--echo # +--echo # test of symbolic names +--echo # +--echo # creation test (names) +set names utf8; +select hex(column_create("адын", 1212)); +select hex(column_create("1212", 1212)); +select hex(column_create(1212, 2, "www", 3)); +select hex(column_create("1212", 2, "www", 3)); +select hex(column_create("1212", 2, 3, 3)); +select hex(column_create("1212", 2, "адын", 1, 3, 3)); +set names default; + +--echo # fetching column test (names) +set names utf8; +select column_get(column_create("адын", 1212), "адын" as int); +select column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int); +select column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int); +select column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int); +select column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int); +select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int); +select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int); +set names default; + +--echo # column existance test (names) +set names utf8; +select column_exists(column_create("адын", 1212), "адын"); +select column_exists(column_create("адын", 1212), "aады"); +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын"); +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212); +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3"); +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3); +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4); +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4"); +set names default; + +--echo # column changing test (names) +select hex(column_add(column_create(1, "AAA"), "b", "BBB")); +select hex(column_add(column_create("1", "AAA"), "b", "BBB")); +select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char); +select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char); +select hex(column_add(column_create("a", "AAA"), 1, "BBB")); +select hex(column_add(column_create("a", "AAA"), "1", "BBB")); +select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer)); +select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer)); +select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer)); +select hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer)); +select hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer)); +select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer); +select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer); +select hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer)); +select hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer)); +select hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer)); +select hex(column_add(column_create("a", 1), "a", null)); +select column_list(column_add(column_create("a", 1), "a", null)); +select column_list(column_add(column_create("a", 1), "a", "")); +select hex(column_add("", "a", 1)); + +-- echo # column delete (names) +select hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a")); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b")); +select hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer)); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c")); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d")); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a")); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c")); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c")); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e")); +select hex(column_delete(column_create("a", 1), "a")); +select hex(column_delete("", "a")); + +--echo # +--echo # MDEV-458 DNAMES: Server crashes on using an unquoted string +--echo # as a dynamic column name +--echo # +--error ER_BAD_FIELD_ERROR +select COLUMN_CREATE(color, "black"); + +--echo # +--echo # MDEV-489 Assertion `offset < 0x1f' failed in +--echo # type_and_offset_store on COLUMN_ADD +--echo # +CREATE TABLE t1 (f1 tinyblob); + +INSERT INTO t1 VALUES (COLUMN_CREATE('col1', REPEAT('a',30))); +select column_check(f1) from t1; +UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('b',211), 'val2' ); +# we can't detect last string cut with 100% probability, +# because we detect it by string end +select column_check(f1) from t1; +UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('c',211), 'val3' ); +select column_check(f1) from t1; + +drop table t1; + +--echo # +--echo # MDEV-490/MDEV-491 null as arguments +--echo # +SELECT COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR ); +SELECT COLUMN_GET( NULL, 'col' as char ); +SELECT COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL); +SELECT COLUMN_EXISTS( NULL, 'col'); +SELECT COLUMN_CREATE( NULL, 'val' ); +SELECT COLUMN_ADD( NULL, 'val', 'col'); + +--echo # +--echo # MDEV-488: Assertion `column_name->length < 255' failed on a +--echo # column name with length 255 (precisely) +--echo # +SELECT hex(COLUMN_CREATE(REPEAT('a',255),1)); +--error ER_DYN_COL_DATA +SELECT hex(COLUMN_CREATE(REPEAT('a',65536),1)); + +--echo # +--echo # JSON conversion +--echo # +select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date)); +select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date)); + +--echo # +--echo # CHECK test +--echo # +SELECT COLUMN_CHECK(COLUMN_CREATE(1,'a')); +SELECT COLUMN_CHECK('abracadabra'); +SELECT COLUMN_CHECK(''); +SELECT COLUMN_CHECK(NULL); + +--echo # +--echo # escaping check +--echo # +select column_json(column_create("string", "'\"/\\`.,whatever")),hex(column_create("string", "'\"/\\`.,whatever")); + +--echo # +--echo # embedding test +--echo # +select column_json(column_create("val", "val", "emb", column_create("val2", "val2"))); +select column_json(column_create(1, "val", 2, column_create(3, "val2"))); + +--echo # +--echo # Time encoding +--echo # +select hex(column_create("t", "800:46:06.23434" AS time)) as hex, + column_json(column_create("t", "800:46:06.23434" AS time)) as json; +select hex(column_create(1, "800:46:06.23434" AS time)) as hex, + column_json(column_create(1, "800:46:06.23434" AS time)) as json; + +select hex(column_create("t", "800:46:06" AS time)) as hex, + column_json(column_create("t", "800:46:06" AS time)) as json; +select hex(column_create(1, "800:46:06" AS time)) as hex, + column_json(column_create(1, "800:46:06" AS time)) as json; + +select hex(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as hex, + column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as json; +select hex(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as hex, + column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as json; + +select hex(column_create("t", "2012-12-21 10:46:06" AS datetime)) as hex, + column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as json; +select hex(column_create(1, "2012-12-21 10:46:06" AS datetime)) as hex, + column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as json; diff --git a/mysql-test/t/failed_auth_3909.test b/mysql-test/t/failed_auth_3909.test new file mode 100644 index 00000000000..3179794d155 --- /dev/null +++ b/mysql-test/t/failed_auth_3909.test @@ -0,0 +1,37 @@ +source include/not_embedded.inc; + +# +# MDEV-3909 remote user enumeration +# +# verify that for some failed login attemps (with wrong user names) +# the server requests a plugin +# +optimize table mysql.user; +insert mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar'); +flush privileges; + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_PLUGIN_IS_NOT_LOADED +connect (fail,localhost,u1); + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR +connect (fail,localhost,u2); + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR +connect (fail,localhost,u2,password); + +--error ER_PLUGIN_IS_NOT_LOADED +change_user u1; + +--error ER_ACCESS_DENIED_ERROR +change_user u2; + +--error ER_ACCESS_DENIED_ERROR +change_user u2,password; + +delete from mysql.user where plugin = 'bar'; +flush privileges; + + diff --git a/mysql-test/t/file_contents.test b/mysql-test/t/file_contents.test index 835ea563c7b..d54a60e62a3 100644 --- a/mysql-test/t/file_contents.test +++ b/mysql-test/t/file_contents.test @@ -42,8 +42,8 @@ if ($dir_bin eq '/usr/') { $dir_docs = "$dir_docs/Docs"; # development tree } } -$found_version = "No line 'MySQL source #.#.#'"; -$found_revision = "No line 'revision-id: .....'"; +$found_version = "No line 'MySQL source #.#.#' in $dir_docs/INFO_SRC"; +$found_revision = "No line 'revision-id: .....' in $dir_docs/INFO_SRC"; open(I_SRC,"<","$dir_docs/INFO_SRC") or print "Cannot open 'INFO_SRC' in '$dir_docs' (starting from bindir '$dir_bin')\n"; while(defined ($line = <I_SRC>)) { if ($line =~ m|^MySQL source \d+\.\d\.\d+|) {$found_version = "Found MySQL version number";} diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index e4a1206fa9c..936b93b49c9 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -375,7 +375,7 @@ select group_concat('x') UNION ALL select 1; drop table t1; # -# Bug #12863 : missing separators after first empty cancatanated elements +# Bug #12863 : missing separators after first empty concatenated elements # CREATE TABLE t1 (id int, a varchar(9)); @@ -795,3 +795,11 @@ INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b; SET group_concat_max_len = DEFAULT; SET @@sql_mode = @old_sql_mode; DROP TABLE t1, t2; + +# +# MDEV-3987 uninitialized read in Item_cond::fix_fields leads to crash: select .. where .. in ( select ... ) +# +create table t1 (a char(1) character set utf8); +insert into t1 values ('a'),('b'); +select 1 from t1 where a in (select group_concat(a) from t1); +drop table t1; diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index 1f221ce9878..292db69a6e3 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -348,6 +348,25 @@ SELECT 1 from t1 HAVING NAME_CONST('', a); DROP TABLE t1; +--echo # +--echo # Test or correct maybe_null of last_value +--echo # +CREATE TABLE t1 (a char(2) not null ); +INSERT INTO t1 VALUES (4),(7),(1); +set @optimizer_switch_save= @@optimizer_switch; +set optimizer_switch='materialization=off'; +CREATE TABLE tv (e char(2) not null ) engine=mysql; +INSERT INTO tv VALUES (1); +CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv; +CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv; +explain extended +select a from t1 left join v_merge on (a=e) where last_value(NULL,e) not in (select last_value(NULL,e) from vm); +explain extended +select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm); +set optimizer_switch=@optimizer_switch_save; +drop view v_merge, vm; +drop table t1,tv; + --echo # --echo # End of 5.5 tests diff --git a/mysql-test/t/gis2.test b/mysql-test/t/gis2.test new file mode 100644 index 00000000000..b734ab19ecd --- /dev/null +++ b/mysql-test/t/gis2.test @@ -0,0 +1,17 @@ +# +# MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column +# + +CREATE TABLE t1 ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + point_data POINT NOT NULL, + PRIMARY KEY (id), + KEY idx_point_data(point_data) +) ENGINE=MyISAM; +INSERT t1 (point_data) VALUES + (GeomFromText('Point(37.0248492 23.8512726)')), + (GeomFromText('Point(38.0248492 23.8512726)')); +SELECT id FROM t1 +WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); +DROP TABLE t1; + diff --git a/mysql-test/t/grant_lowercase.opt b/mysql-test/t/grant_lowercase.opt new file mode 100644 index 00000000000..5b0a3d41b41 --- /dev/null +++ b/mysql-test/t/grant_lowercase.opt @@ -0,0 +1 @@ +--lower-case-table-names=1 diff --git a/mysql-test/t/grant_lowercase.test b/mysql-test/t/grant_lowercase.test new file mode 100644 index 00000000000..b07cb88afd6 --- /dev/null +++ b/mysql-test/t/grant_lowercase.test @@ -0,0 +1,31 @@ +# test cases for strmov(tmp_db, db) -> strnmov replacement in sql_acl.cc +--source include/not_embedded.inc + +# +# http://seclists.org/fulldisclosure/2012/Dec/4 +# + +# in acl_get(), check_grant_db(), mysql_grant() +grant file on *.* to user1@localhost with grant option; +grant select on `a%`.* to user1@localhost with grant option; +connect (conn1,localhost,user1,,); +connection conn1; +--error ER_WRONG_DB_NAME +grant file on aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.* to 'user'@'%' identified by 'secret'; +connection default; +disconnect conn1; +drop user user1@localhost; + +# in acl_load() +call mtr.add_suppression("Incorrect database name"); +alter table mysql.host modify Db varchar(200); +alter table mysql.db modify Db varchar(200); +insert mysql.host set db=concat('=>', repeat(_utf8 'й', 200)); +insert mysql.db set db=concat('=>', repeat(_utf8 'й', 200)); +flush privileges; # shouldn't crash here +delete from mysql.host where db like '=>%'; +delete from mysql.db where db like '=>%'; +alter table mysql.host modify Db char(64); +alter table mysql.db modify Db char(64); +flush privileges; + diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 854023052cf..b2dd84f63c7 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1,3 +1,4 @@ +--source include/have_innodb.inc # Initialise --disable_warnings @@ -1483,6 +1484,41 @@ DROP TABLE t1; --echo the value below *must* be 1 show status like 'Created_tmp_disk_tables'; +--echo # +--echo # Bug #1002146: Unneeded filesort if usage of join buffer is not allowed +--echo # (bug mdev-645) +--echo # + +CREATE TABLE t1 (pk int PRIMARY KEY, a int, INDEX idx(a)); +INSERT INTO t1 VALUES (3,2), (2,3), (5,3), (6,4); + +CREATE TABLE t2 (pk int PRIMARY KEY, a int, INDEX idx(a)); +INSERT INTO t2 VALUES (9,0), (10,3), (6,4), (1,6), (3,100), (5,200); + +set join_cache_level=0; + +EXPLAIN +SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 + GROUP BY t2.a; +SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 + GROUP BY t2.a; + +set join_cache_level=default; + +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='outer_join_with_cache=off'; + +EXPLAIN +SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 + GROUP BY t2.a; +SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 + GROUP BY t2.a; + +set optimizer_switch=@save_optimizer_switch; + + +DROP TABLE t1,t2; + --echo # End of 5.3 tests --echo # @@ -1509,6 +1545,48 @@ DROP TABLE t1; --echo #End of test#49771 --echo # +--echo # Test of bug in GROUP_CONCAT with ROLLUP +--echo # + +CREATE TABLE t1 ( b VARCHAR(8) NOT NULL, a INT NOT NULL ) ENGINE=MyISAM; +INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'v'); + +CREATE TABLE t2 ( c VARCHAR(8), d INT, KEY (c, d) ) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('v',6),('c',4),('v',3); + +SELECT b, GROUP_CONCAT( a, b ORDER BY a, b ) +FROM t1 JOIN t2 ON c = b GROUP BY b; + +SELECT b, GROUP_CONCAT( a, b ORDER BY a, b ) +FROM t1 JOIN t2 ON c = b GROUP BY b WITH ROLLUP; + +DROP TABLE t1,t2; + +--echo # +--echo # Test of MDEV-4002 +--echo # + +CREATE TABLE t1 ( + pk INT NOT NULL PRIMARY KEY, + d1 DOUBLE, + d2 DOUBLE, + i INT NOT NULL DEFAULT '0', + KEY (i) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES (1,1.0,1.1,1),(2,2.0,2.2,2); + +PREPARE stmt FROM " +SELECT DISTINCT i, GROUP_CONCAT( d1, d2 ORDER BY d1, d2 ) +FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP +"; + +EXECUTE stmt; +EXECUTE stmt; + +DROP TABLE t1; + +--echo # --echo # Bug #58782 --echo # Missing rows with SELECT .. WHERE .. IN subquery --echo # with full GROUP BY and no aggr diff --git a/mysql-test/t/group_by_innodb.test b/mysql-test/t/group_by_innodb.test new file mode 100644 index 00000000000..0d5e5e9ae30 --- /dev/null +++ b/mysql-test/t/group_by_innodb.test @@ -0,0 +1,38 @@ +# +# Test GROUP BY queries that utilize InnoDB extended keys +# + +--source include/have_innodb.inc + +--echo # +--echo # MDEV-3992 Server crash or valgrind errors in test_if_skip_sort_order/test_if_cheaper_ordering +--echo # on GROUP BY with indexes on InnoDB table +--echo # + +CREATE TABLE t1 ( + pk INT PRIMARY KEY, + a VARCHAR(1) NOT NULL, + KEY (pk) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES (1,'a'),(2,'b'); + +EXPLAIN +SELECT COUNT(*), pk field1, pk AS field2 +FROM t1 WHERE a = 'r' OR pk = 183 +GROUP BY field1, field2; + +SELECT COUNT(*), pk field1, pk AS field2 +FROM t1 WHERE a = 'r' OR pk = 183 +GROUP BY field1, field2; + +EXPLAIN +SELECT COUNT(*), pk field1 FROM t1 +WHERE a = 'r' OR pk = 183 GROUP BY field1, field1; + +SELECT COUNT(*), pk field1 FROM t1 +WHERE a = 'r' OR pk = 183 GROUP BY field1, field1; + +drop table t1; + +--echo End of 5.5 tests diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index b984acc78ea..19f7cbe40a1 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -1155,6 +1155,15 @@ ORDER BY min_a; DROP TABLE t1; +# +# MDEV-729 lp:998028 - Server crashes on normal shutdown in closefrm after executing a query from MyISAM table +# +create table t1 (a int, b varchar(1), key(b,a)) engine=myisam; +insert t1 values (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(null,'i'); +select min(a), b from t1 where a=7 or b='z' group by b; +flush tables; +drop table t1; + --echo # --echo # LP BUG#888456 Wrong result with DISTINCT , ANY , subquery_cache=off , NOT NULL --echo # diff --git a/mysql-test/t/information_schema2.test b/mysql-test/t/information_schema2.test new file mode 100644 index 00000000000..c2479087f47 --- /dev/null +++ b/mysql-test/t/information_schema2.test @@ -0,0 +1,9 @@ + +# +# MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling +# +select variable_name from information_schema.session_status where variable_name = +(select variable_name from information_schema.session_status where variable_name = 'uptime'); +select variable_name from information_schema.session_variables where variable_name = +(select variable_name from information_schema.session_variables where variable_name = 'basedir'); + diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index f9181f91a89..bf84bdf9194 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -572,36 +572,40 @@ DROP TABLE t1; connection default; disconnect con1; +############################################################################# +# The below protion is moved to ctype_ucs.test # +############################################################################# +#--echo # +#--echo # Bug #51876 : crash/memory underrun when loading data with ucs2 +#--echo # and reverse() function +#--echo # + +#--echo # Problem # 1 (original report): wrong parsing of ucs2 data +#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; +#CREATE TABLE t1(a INT); +#LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 +#(@b) SET a=REVERSE(@b); +#--echo # should return 2 zeroes (as the value is truncated) +#SELECT * FROM t1; + +#DROP TABLE t1; +#let $MYSQLD_DATADIR= `select @@datadir`; +#remove_file $MYSQLD_DATADIR/test/tmpp.txt; + + +#--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost +#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +#CREATE TABLE t1(a INT); +#LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 +#(@b) SET a=REVERSE(@b); +#--echo # should return 0 and 1 (10 reversed) +#SELECT * FROM t1; + +#DROP TABLE t1; +#let $MYSQLD_DATADIR= `select @@datadir`; +#remove_file $MYSQLD_DATADIR/test/tmpp2.txt; +###################################################################################### ---echo # ---echo # Bug #51876 : crash/memory underrun when loading data with ucs2 ---echo # and reverse() function ---echo # - ---echo # Problem # 1 (original report): wrong parsing of ucs2 data -SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; -CREATE TABLE t1(a INT); -LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 -(@b) SET a=REVERSE(@b); ---echo # should return 2 zeroes (as the value is truncated) -SELECT * FROM t1; - -DROP TABLE t1; -let $MYSQLD_DATADIR= `select @@datadir`; -remove_file $MYSQLD_DATADIR/test/tmpp.txt; - - ---echo # Problem # 2 : if you write and read ucs2 data to a file they're lost -SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; -CREATE TABLE t1(a INT); -LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 -(@b) SET a=REVERSE(@b); ---echo # should return 0 and 1 (10 reversed) -SELECT * FROM t1; - -DROP TABLE t1; -let $MYSQLD_DATADIR= `select @@datadir`; -remove_file $MYSQLD_DATADIR/test/tmpp2.txt; --echo # --echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 3269b88ca04..71a985654ef 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -582,5 +582,17 @@ DROP DATABASE connected_db; --remove_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql --remove_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql +# +# USE and names with backticks +# +--write_file $MYSQLTEST_VARDIR/tmp/backticks.sql +USE aa`bb``cc +SELECT DATABASE(); +EOF +create database `aa``bb````cc`; +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/backticks.sql +drop database `aa``bb````cc`; + + --echo --echo End of tests diff --git a/mysql-test/t/mysqlbinlog-cp932-master.opt b/mysql-test/t/mysqlbinlog-cp932-master.opt deleted file mode 100644 index bb0cda4519a..00000000000 --- a/mysql-test/t/mysqlbinlog-cp932-master.opt +++ /dev/null @@ -1 +0,0 @@ ---max-binlog-size=8192 diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test deleted file mode 100644 index 2a210bea0e0..00000000000 --- a/mysql-test/t/mysqlbinlog-cp932.test +++ /dev/null @@ -1,26 +0,0 @@ -# disabled in embedded until tools running is fixed with embedded ---source include/not_embedded.inc - --- source include/have_binlog_format_mixed_or_statement.inc --- source include/have_cp932.inc --- source include/have_log_bin.inc - -RESET MASTER; - -# Bug#16217 (mysql client did not know how not switch its internal charset) -create table t3 (f text character set utf8); -create table t4 (f text character set cp932); ---exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'ソ')" ---exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ƒ\');" -flush logs; -rename table t3 to t03, t4 to t04; -let $MYSQLD_DATADIR= `select @@datadir`; ---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8 -# original and recovered data must be equal -select HEX(f) from t03; -select HEX(f) from t3; -select HEX(f) from t04; -select HEX(f) from t4; - -drop table t3, t4, t03, t04; ---echo End of 5.0 tests diff --git a/mysql-test/t/mysqlbinlog2-master.opt b/mysql-test/t/mysqlbinlog2-master.opt deleted file mode 100644 index 4d69f3359db..00000000000 --- a/mysql-test/t/mysqlbinlog2-master.opt +++ /dev/null @@ -1 +0,0 @@ ---timezone=GMT-3 diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test deleted file mode 100644 index 986e180db13..00000000000 --- a/mysql-test/t/mysqlbinlog2.test +++ /dev/null @@ -1,187 +0,0 @@ -# Test for the new options --start-datetime, stop-datetime, -# and a few others. - -# TODO: Need to look at making row based version once new binlog client is complete. --- source include/have_binlog_format_mixed_or_statement.inc --- source include/binlog_start_pos.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings -reset master; - -# We need this for getting fixed timestamps inside of this test. -# I use a date in the future to keep a growing timestamp along the -# binlog (including the Start_log_event). This test will work -# unchanged everywhere, because mysql-test-run has fixed TZ, which it -# exports (so mysqlbinlog has same fixed TZ). -set @a=UNIX_TIMESTAMP("2020-01-21 15:32:22"); -set timestamp=@a; -create table t1 (a int auto_increment not null primary key, b char(3)); -insert into t1 values(null, "a"); -insert into t1 values(null, "b"); -set timestamp=@a+2; ---let $binlog_pos_760=query_get_value(SHOW MASTER STATUS, Position, 1) -insert into t1 values(null, "c"); ---let $binlog_pos_951=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000001' from $binlog_pos_760, Pos, 5) -set timestamp=@a+4; -insert into t1 values(null, "d"); -insert into t1 values(null, "e"); - -flush logs; -set timestamp=@a+1; # this could happen on a slave -insert into t1 values(null, "f"); ---let $binlog_pos_135=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 4) ---let $binlog_pos_203=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 5) - -# delimiters are for easier debugging in future - ---disable_query_log -select "--- Local --" as ""; ---enable_query_log - -# -# We should use --short-form everywhere because in other case output will -# be time dependent (the Start events). Better than nothing. -# -let $MYSQLD_DATADIR= `select @@datadir`; ---exec $MYSQL_BINLOG --short-form --base64-output=never $MYSQLD_DATADIR/master-bin.000001 - ---disable_query_log -select "--- offset --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --short-form --offset=3 $MYSQLD_DATADIR/master-bin.000001 ---disable_query_log -select "--- start-position --" as ""; ---enable_query_log -let $start_pos= `select @binlog_start_pos + 693`; ---exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 ---disable_query_log -select "--- stop-position --" as ""; ---enable_query_log -let $stop_pos= `select @binlog_start_pos + 693`; ---exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 ---disable_query_log -select "--- start and stop positions ---" as ""; ---enable_query_log -let $start_pos= `select @binlog_start_pos + 693`; -let $stop_pos= `select @binlog_start_pos + 810`; ---exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 ---disable_query_log -select "--- start-datetime --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 ---disable_query_log -select "--- stop-datetime --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 - ---disable_query_log -select "--- Local with 2 binlogs on command line --" as ""; ---enable_query_log - -# This is to verify that some options apply only to first, or last binlog - -flush logs; ---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 - ---disable_query_log -select "--- offset --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --short-form --offset=3 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 ---disable_query_log -select "--- start-position --" as ""; ---enable_query_log -let $start_pos= `select @binlog_start_pos + 693`; ---exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 ---disable_query_log -select "--- stop-position --" as ""; ---enable_query_log -let $stop_pos= `select @binlog_start_pos + 109`; ---exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 ---disable_query_log -select "--- start-datetime --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 ---disable_query_log -select "--- stop-datetime --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 - ---disable_query_log -select "--- Remote --" as ""; ---enable_query_log - ---exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 - ---disable_query_log -select "--- offset --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --short-form --offset=3 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 ---disable_query_log -select "--- start-position --" as ""; ---enable_query_log -let $start_pos= `select @binlog_start_pos + 693`; ---exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 ---disable_query_log -select "--- stop-position --" as ""; ---enable_query_log -let $stop_pos= `select @binlog_start_pos + 693`; ---exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 ---disable_query_log -select "--- start and stop positions ---" as ""; ---enable_query_log -let $start_pos= `select @binlog_start_pos + 693`; -let $stop_pos= `select @binlog_start_pos + 810`; ---exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 ---disable_query_log -select "--- start-datetime --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 ---disable_query_log -select "--- stop-datetime --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 - ---disable_query_log -select "--- Remote with 2 binlogs on command line --" as ""; ---enable_query_log - ---exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 - ---disable_query_log -select "--- offset --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --short-form --offset=3 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 ---disable_query_log -select "--- start-position --" as ""; ---enable_query_log -let $start_pos= `select @binlog_start_pos + 693`; ---exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 ---disable_query_log -select "--- stop-position --" as ""; ---enable_query_log -let $stop_pos= `select @binlog_start_pos + 68`; ---exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 ---disable_query_log -select "--- start-datetime --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --short-form "--start-datetime=20200121153224" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 ---disable_query_log -select "--- stop-datetime --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020/01/21 15@32@24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 - ---disable_query_log -select "--- to-last-log --" as ""; ---enable_query_log - ---exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --to-last-log master-bin.000001 - -# clean up ---disable_query_log -select "--- end of test --" as ""; ---enable_query_log -drop table t1; - -# End of 4.1 tests diff --git a/mysql-test/t/mysqlbinlog_base64.test b/mysql-test/t/mysqlbinlog_base64.test deleted file mode 100644 index 3d3444cea1c..00000000000 --- a/mysql-test/t/mysqlbinlog_base64.test +++ /dev/null @@ -1,102 +0,0 @@ --- source include/have_binlog_format_row.inc -# -# Reset master to cleanup binlog -# -reset master; - -# -# Write different events to binlog -# -create table t1 (a int); -insert into t1 values (1); -insert into t1 values (2); -insert into t1 values (3); -update t1 set a=a+2 where a=2; -update t1 set a=a+2 where a=3; - -create table t2 (word varchar(20)); -load data infile '../../std_data/words.dat' into table t2; - -# -# Save binlog -# -let $MYSQLD_DATADIR=`select @@datadir`; -flush logs; ---exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql - -# -# Clear database and restore from binlog -# -drop table t1; -drop table t2; ---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql - -# -# Verify that all binlog events have been executed -# -select * from t1; -select * from t2; - -# -# Verify that events larger than the default IO_CACHE buffer -# are handled correctly (BUG#25628). -# -flush logs; -drop table t2; -create table t2 (word varchar(20)); -load data infile '../../std_data/words.dat' into table t2; -insert into t2 select * from t2; -insert into t2 select * from t2; -insert into t2 select * from t2; -insert into t2 select * from t2; -insert into t2 select * from t2; -insert into t2 select * from t2; -insert into t2 select * from t2; -insert into t2 select * from t2; -insert into t2 select * from t2; -select count(*) from t2; - -flush logs; ---exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000003 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql ---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql - -# -# Verify that all binlog events have been executed -# -select count(*) from t2; - -# -# Test cleanup -# ---remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql -drop table t1; -drop table t2; - -# -# BUG#12354268 -# -# This test verifies that using --start-position with DECODE-ROWS -# does not make mysqlbinlog to output an error stating that it -# does not contain any FD event. -# - -RESET MASTER; -USE test; -SET @old_binlog_format= @@binlog_format; -SET SESSION binlog_format=ROW; -CREATE TABLE t1(c1 INT); ---let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1) ---let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1) ---let $MYSQLD_DATADIR= `SELECT @@datadir` - -INSERT INTO t1 VALUES (1); - -FLUSH LOGS; - ---disable_result_log ---exec $MYSQL_BINLOG --base64-output=DECODE-ROWS --start-position=$master_pos -v $MYSQLD_DATADIR/$master_binlog ---enable_result_log - -DROP TABLE t1; -SET SESSION binlog_format= @old_binlog_format; -RESET MASTER; diff --git a/mysql-test/t/mysqlbinlog_row-master.opt b/mysql-test/t/mysqlbinlog_row-master.opt deleted file mode 100644 index 4d69f3359db..00000000000 --- a/mysql-test/t/mysqlbinlog_row-master.opt +++ /dev/null @@ -1 +0,0 @@ ---timezone=GMT-3 diff --git a/mysql-test/t/mysqlbinlog_row.test b/mysql-test/t/mysqlbinlog_row.test deleted file mode 100644 index 9b41c63d195..00000000000 --- a/mysql-test/t/mysqlbinlog_row.test +++ /dev/null @@ -1,446 +0,0 @@ ---source include/have_log_bin.inc ---source include/have_binlog_format_row.inc ---source include/have_ucs2.inc - ---echo # ---echo # Preparatory cleanup. ---echo # ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - ---echo # ---echo # We need a fixed timestamp to avoid varying results. ---echo # -SET timestamp=1000000000; - ---echo # ---echo # Delete all existing binary logs. ---echo # -RESET MASTER; - - -CREATE TABLE t1 (c01 BIT); -INSERT INTO t1 VALUES (0); -INSERT INTO t1 VALUES (1); -DROP TABLE t1; - -CREATE TABLE t1 (c01 BIT(7)); -INSERT INTO t1 VALUES (1); -INSERT INTO t1 VALUES (2); -INSERT INTO t1 VALUES (4); -INSERT INTO t1 VALUES (8); -INSERT INTO t1 VALUES (16); -INSERT INTO t1 VALUES (32); -INSERT INTO t1 VALUES (64); -INSERT INTO t1 VALUES (127); -DELETE FROM t1 WHERE c01=127; -UPDATE t1 SET c01=15 WHERE c01=16; -DROP TABLE t1; - -CREATE TABLE t1 (a BIT(20), b CHAR(2)); -INSERT INTO t1 VALUES (b'00010010010010001001', 'ab'); -DROP TABLE t1; - -CREATE TABLE t1 (c02 BIT(64)); -INSERT INTO t1 VALUES (1); -INSERT INTO t1 VALUES (2); -INSERT INTO t1 VALUES (128); -INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111'); -DROP TABLE t1; - - -CREATE TABLE t1 (c03 TINYINT); -INSERT INTO t1 VALUES (1),(2),(3); -INSERT INTO t1 VALUES (-128); -UPDATE t1 SET c03=2 WHERE c03=1; -DELETE FROM t1 WHERE c03=-128; -DROP TABLE t1; - -CREATE TABLE t1 (c04 TINYINT UNSIGNED); -INSERT INTO t1 VALUES (128), (255); -UPDATE t1 SET c04=2 WHERE c04=1; -DELETE FROM t1 WHERE c04=255; -DROP TABLE t1; - -CREATE TABLE t1 (c06 BOOL); -INSERT INTO t1 VALUES (TRUE); -DELETE FROM t1 WHERE c06=TRUE; -DROP TABLE t1; - -CREATE TABLE t1 (c07 SMALLINT); -INSERT INTO t1 VALUES (1234); -DELETE FROM t1 WHERE c07=1234; -DROP TABLE t1; - -CREATE TABLE t1 (c08 SMALLINT UNSIGNED); -INSERT INTO t1 VALUES (32768), (65535); -UPDATE t1 SET c08=2 WHERE c08=32768; -DELETE FROM t1 WHERE c08=65535; -DROP TABLE t1; - -CREATE TABLE t1 (c10 MEDIUMINT); -INSERT INTO t1 VALUES (12345); -DELETE FROM t1 WHERE c10=12345; -DROP TABLE t1; - -CREATE TABLE t1 (c11 MEDIUMINT UNSIGNED); -INSERT INTO t1 VALUES (8388608), (16777215); -UPDATE t1 SET c11=2 WHERE c11=8388608; -DELETE FROM t1 WHERE c11=16777215; -DROP TABLE t1; - -CREATE TABLE t1 (c13 INT); -INSERT INTO t1 VALUES (123456); -DELETE FROM t1 WHERE c13=123456; -DROP TABLE t1; - -CREATE TABLE t1 (c14 INT UNSIGNED); -INSERT INTO t1 VALUES (2147483648), (4294967295); -UPDATE t1 SET c14=2 WHERE c14=2147483648; -DELETE FROM t1 WHERE c14=4294967295; -DROP TABLE t1; - -CREATE TABLE t1 (c16 BIGINT); -INSERT INTO t1 VALUES (1234567890); -DELETE FROM t1 WHERE c16=1234567890; -DROP TABLE t1; - -CREATE TABLE t1 (c17 BIGINT UNSIGNED); -INSERT INTO t1 VALUES (9223372036854775808), (18446744073709551615); -UPDATE t1 SET c17=2 WHERE c17=9223372036854775808; -DELETE FROM t1 WHERE c17=18446744073709551615; -DROP TABLE t1; - -CREATE TABLE t1 (c19 FLOAT); -INSERT INTO t1 VALUES (123.2234); -DELETE FROM t1 WHERE c19>123; -DROP TABLE t1; - -CREATE TABLE t1 (c22 DOUBLE); -INSERT INTO t1 VALUES (123434.22344545); -DELETE FROM t1 WHERE c22>123434; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c25 DECIMAL(10,5)); -INSERT INTO t1 VALUES (124.45); -INSERT INTO t1 VALUES (-543.21); -DELETE FROM t1 WHERE c25=124.45; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c28 DATE); -INSERT INTO t1 VALUES ('2001-02-03'); -DELETE FROM t1 WHERE c28='2001-02-03'; -DROP TABLE t1; - -CREATE TABLE t1 (c29 DATETIME); -INSERT INTO t1 VALUES ('2001-02-03 10:20:30'); -DELETE FROM t1 WHERE c29='2001-02-03 10:20:30'; -DROP TABLE t1; - -CREATE TABLE t1 (c30 TIMESTAMP); -INSERT INTO t1 VALUES ('2001-02-03 10:20:30'); -DELETE FROM t1 WHERE c30='2001-02-03 10:20:30'; -DROP TABLE t1; - -CREATE TABLE t1 (c31 TIME); -INSERT INTO t1 VALUES ('11:22:33'); -DELETE FROM t1 WHERE c31='11:22:33'; -DROP TABLE t1; - -CREATE TABLE t1 (c32 YEAR); -INSERT INTO t1 VALUES ('2001'); -DELETE FROM t1 WHERE c32=2001; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c33 CHAR); -INSERT INTO t1 VALUES ('a'); -DELETE FROM t1 WHERE c33='a'; -DROP TABLE t1; - -CREATE TABLE t1 (c34 CHAR(0)); -INSERT INTO t1 VALUES (''); -DELETE FROM t1 WHERE c34=''; -DROP TABLE t1; - -CREATE TABLE t1 (c35 CHAR(1)); -INSERT INTO t1 VALUES ('b'); -DELETE FROM t1 WHERE c35='b'; -DROP TABLE t1; - -CREATE TABLE t1 (c36 CHAR(255)); -INSERT INTO t1 VALUES (repeat('c',255)); -DELETE FROM t1 WHERE c36>'c'; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c37 NATIONAL CHAR); -INSERT INTO t1 VALUES ('a'); -DELETE FROM t1 WHERE c37='a'; -DROP TABLE t1; - -CREATE TABLE t1 (c38 NATIONAL CHAR(0)); -INSERT INTO t1 VALUES (''); -DELETE FROM t1 WHERE c38=''; -DROP TABLE t1; - -CREATE TABLE t1 (c39 NATIONAL CHAR(1)); -INSERT INTO t1 VALUES ('a'); -DELETE FROM t1 WHERE c39='a'; -DROP TABLE t1; - -CREATE TABLE t1 (c40 NATIONAL CHAR(255)); -INSERT INTO t1 VALUES (repeat('a', 255)); -INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255)); -DELETE FROM t1 WHERE c40>'a'; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c41 CHAR CHARACTER SET UCS2); -INSERT INTO t1 VALUES ('a'); -DELETE FROM t1 WHERE c41='a'; -DROP TABLE t1; - -CREATE TABLE t1 (c42 CHAR(0) CHARACTER SET UCS2); -INSERT INTO t1 VALUES (''); -DELETE FROM t1 WHERE c42=''; -DROP TABLE t1; - -CREATE TABLE t1 (c43 CHAR(1) CHARACTER SET UCS2); -INSERT INTO t1 VALUES ('a'); -DELETE FROM t1 WHERE c43='a'; -DROP TABLE t1; - -CREATE TABLE t1 (c44 CHAR(255) CHARACTER SET UCS2); -INSERT INTO t1 VALUES (repeat('a', 255)); -INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255)); -DELETE FROM t1 WHERE c44>'a'; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c45 VARCHAR(0)); -INSERT INTO t1 VALUES (''); -DELETE FROM t1 WHERE c45=''; -DROP TABLE t1; - -CREATE TABLE t1 (c46 VARCHAR(1)); -INSERT INTO t1 VALUES ('a'); -DELETE FROM t1 WHERE c46='a'; -DROP TABLE t1; - -CREATE TABLE t1 (c47 VARCHAR(255)); -INSERT INTO t1 VALUES (repeat('a',255)); -DELETE FROM t1 WHERE c47>'a'; -DROP TABLE t1; - -CREATE TABLE t1 (c48 VARCHAR(261)); -INSERT INTO t1 VALUES (repeat('a',261)); -DELETE FROM t1 WHERE c48>'a'; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c49 NATIONAL VARCHAR(0)); -INSERT INTO t1 VALUES (''); -DELETE FROM t1 WHERE c49=''; -DROP TABLE t1; - -CREATE TABLE t1 (c50 NATIONAL VARCHAR(1)); -INSERT INTO t1 VALUES ('a'); -DELETE FROM t1 WHERE c50='a'; -DROP TABLE t1; - -CREATE TABLE t1 (c51 NATIONAL VARCHAR(255)); -INSERT INTO t1 VALUES (repeat('a',255)); -INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255)); -DELETE FROM t1 WHERE c51>'a'; -DROP TABLE t1; - -CREATE TABLE t1 (c52 NATIONAL VARCHAR(261)); -INSERT INTO t1 VALUES (repeat('a',261)); -INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 261)); -DELETE FROM t1 WHERE c52>'a'; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c53 VARCHAR(0) CHARACTER SET ucs2); -INSERT INTO t1 VALUES (''); -DELETE FROM t1 WHERE c53=''; -DROP TABLE t1; - -CREATE TABLE t1 (c54 VARCHAR(1) CHARACTER SET ucs2); -INSERT INTO t1 VALUES ('a'); -DELETE FROM t1 WHERE c54='a'; -DROP TABLE t1; - -CREATE TABLE t1 (c55 VARCHAR(255) CHARACTER SET ucs2); -INSERT INTO t1 VALUES (repeat('ab', 127)); -DELETE FROM t1 WHERE c55>'a'; -DROP TABLE t1; - -CREATE TABLE t1 (c56 VARCHAR(261) CHARACTER SET ucs2); -INSERT INTO t1 VALUES (repeat('ab', 130)); -DELETE FROM t1 WHERE c56>'a'; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c57 BINARY); -INSERT INTO t1 VALUES (0x00); -INSERT INTO t1 VALUES (0x02); -INSERT INTO t1 VALUES ('a'); -DELETE FROM t1 WHERE c57='a'; -DROP TABLE t1; - -CREATE TABLE t1 (c58 BINARY(0)); -INSERT INTO t1 VALUES (''); -DELETE FROM t1 WHERE c58=''; -DROP TABLE t1; - -CREATE TABLE t1 (c59 BINARY(1)); -INSERT INTO t1 VALUES (0x00); -INSERT INTO t1 VALUES (0x02); -INSERT INTO t1 VALUES ('a'); -DELETE FROM t1 WHERE c59='a'; -DROP TABLE t1; - -CREATE TABLE t1 (c60 BINARY(255)); -INSERT INTO t1 VALUES (0x00); -INSERT INTO t1 VALUES (0x02); -INSERT INTO t1 VALUES (repeat('a\0',120)); -DELETE FROM t1 WHERE c60<0x02; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c61 VARBINARY(0)); -INSERT INTO t1 VALUES (''); -DELETE FROM t1 WHERE c61=''; -DROP TABLE t1; - -CREATE TABLE t1 (c62 VARBINARY(1)); -INSERT INTO t1 VALUES (0x00); -INSERT INTO t1 VALUES (0x02); -INSERT INTO t1 VALUES ('a'); -DELETE FROM t1 WHERE c62=0x02; -DROP TABLE t1; - -CREATE TABLE t1 (c63 VARBINARY(255)); -INSERT INTO t1 VALUES (0x00); -INSERT INTO t1 VALUES (0x02); -INSERT INTO t1 VALUES (repeat('a\0',120)); -DELETE FROM t1 WHERE c63=0x02; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c65 TINYBLOB); -INSERT INTO t1 VALUES ('tinyblob1'); -DELETE FROM t1 WHERE c65='tinyblob1'; -DROP TABLE t1; - -CREATE TABLE t1 (c68 BLOB); -INSERT INTO t1 VALUES ('blob1'); -DELETE FROM t1 WHERE c68='blob1'; -DROP TABLE t1; - -CREATE TABLE t1 (c71 MEDIUMBLOB); -INSERT INTO t1 VALUES ('mediumblob1'); -DELETE FROM t1 WHERE c71='mediumblob1'; -DROP TABLE t1; - -CREATE TABLE t1 (c74 LONGBLOB); -INSERT INTO t1 VALUES ('longblob1'); -DELETE FROM t1 WHERE c74='longblob1'; -DROP TABLE t1; - -CREATE TABLE t1 (c66 TINYTEXT); -INSERT INTO t1 VALUES ('tinytext1'); -DELETE FROM t1 WHERE c66='tinytext1'; -DROP TABLE t1; - -CREATE TABLE t1 (c69 TEXT); -INSERT INTO t1 VALUES ('text1'); -DELETE FROM t1 WHERE c69='text1'; -DROP TABLE t1; - -CREATE TABLE t1 (c72 MEDIUMTEXT); -INSERT INTO t1 VALUES ('mediumtext1'); -DELETE FROM t1 WHERE c72='mediumtext1'; -DROP TABLE t1; - -CREATE TABLE t1 (c75 LONGTEXT); -INSERT INTO t1 VALUES ('longtext1'); -DELETE FROM t1 WHERE c75='longtext1'; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c67 TINYTEXT CHARACTER SET UCS2); -INSERT INTO t1 VALUES ('tinytext1'); -DELETE FROM t1 WHERE c67='tinytext1'; -DROP TABLE t1; - -CREATE TABLE t1 (c70 TEXT CHARACTER SET UCS2); -INSERT INTO t1 VALUES ('text1'); -DELETE FROM t1 WHERE c70='text1'; -DROP TABLE t1; - -CREATE TABLE t1 (c73 MEDIUMTEXT CHARACTER SET UCS2); -INSERT INTO t1 VALUES ('mediumtext1'); -DELETE FROM t1 WHERE c73='mediumtext1'; -DROP TABLE t1; - -CREATE TABLE t1 (c76 LONGTEXT CHARACTER SET UCS2); -INSERT INTO t1 VALUES ('longtext1'); -DELETE FROM t1 WHERE c76='longtext1'; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c77 ENUM('a','b','c')); -INSERT INTO t1 VALUES ('b'); -DELETE FROM t1 WHERE c77='b'; -DROP TABLE t1; - -# - -CREATE TABLE t1 (c78 SET('a','b','c','d','e','f')); -INSERT INTO t1 VALUES ('a,b'); -INSERT INTO t1 VALUES ('a,c'); -INSERT INTO t1 VALUES ('b,c'); -INSERT INTO t1 VALUES ('a,b,c'); -INSERT INTO t1 VALUES ('a,b,c,d'); -INSERT INTO t1 VALUES ('a,b,c,d,e'); -INSERT INTO t1 VALUES ('a,b,c,d,e,f'); -DELETE FROM t1 WHERE c78='a,b'; -DROP TABLE t1; - -# -# Check multi-table update -# -CREATE TABLE t1 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0); -CREATE TABLE t2 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0); -INSERT INTO t1 SET a=1; -INSERT INTO t1 SET b=1; -INSERT INTO t2 SET a=1; -INSERT INTO t2 SET b=1; -UPDATE t1, t2 SET t1.a=10, t2.a=20; -DROP TABLE t1,t2; - -flush logs; - -let $MYSQLD_DATADIR= `select @@datadir`; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 diff --git a/mysql-test/t/mysqlbinlog_row_innodb-master.opt b/mysql-test/t/mysqlbinlog_row_innodb-master.opt deleted file mode 100644 index 4d69f3359db..00000000000 --- a/mysql-test/t/mysqlbinlog_row_innodb-master.opt +++ /dev/null @@ -1 +0,0 @@ ---timezone=GMT-3 diff --git a/mysql-test/t/mysqlbinlog_row_innodb.test b/mysql-test/t/mysqlbinlog_row_innodb.test deleted file mode 100644 index cef1a712f7d..00000000000 --- a/mysql-test/t/mysqlbinlog_row_innodb.test +++ /dev/null @@ -1,24 +0,0 @@ -# mysqlbinlog_row_innodb.test -# -# Show that mysqlbinlog displays human readable comments to -# row-based log events. -# -# Main module for the InnoDB storage engine. -# -# Calls include/mysqlbinlog_row.inc -# See there for more informaton. -# - ---source include/have_innodb.inc -let $engine_type=InnoDB; - -# -# The test case would also work with statement based or mixed mode logging. -# But this would require different result files. To handle this with the -# current test suite, new main test cases are required. -# ---source include/have_binlog_format_row.inc ---source include/have_ucs2.inc - ---source include/mysqlbinlog_row_engine.inc - diff --git a/mysql-test/t/mysqlbinlog_row_myisam-master.opt b/mysql-test/t/mysqlbinlog_row_myisam-master.opt deleted file mode 100644 index 4d69f3359db..00000000000 --- a/mysql-test/t/mysqlbinlog_row_myisam-master.opt +++ /dev/null @@ -1 +0,0 @@ ---timezone=GMT-3 diff --git a/mysql-test/t/mysqlbinlog_row_myisam.test b/mysql-test/t/mysqlbinlog_row_myisam.test deleted file mode 100644 index e7b0335812a..00000000000 --- a/mysql-test/t/mysqlbinlog_row_myisam.test +++ /dev/null @@ -1,23 +0,0 @@ -# mysqlbinlog_row.test -# -# Show that mysqlbinlog displays human readable comments to -# row-based log events. -# -# Main module for the MyISAM storage engine. -# -# Calls include/mysqlbinlog_row.inc -# See there for more informaton. -# - -#--source include/have_myisam.inc -let $engine_type=MyISAM; - -# -# The test case would also work with statement based or mixed mode logging. -# But this would require different result files. To handle this with the -# current test suite, new main test cases are required. -# ---source include/have_binlog_format_row.inc ---source include/have_ucs2.inc - ---source include/mysqlbinlog_row_engine.inc diff --git a/mysql-test/t/mysqlbinlog_row_trans-master.opt b/mysql-test/t/mysqlbinlog_row_trans-master.opt deleted file mode 100644 index 4d69f3359db..00000000000 --- a/mysql-test/t/mysqlbinlog_row_trans-master.opt +++ /dev/null @@ -1 +0,0 @@ ---timezone=GMT-3 diff --git a/mysql-test/t/mysqlbinlog_row_trans.test b/mysql-test/t/mysqlbinlog_row_trans.test deleted file mode 100644 index 24abc441c4c..00000000000 --- a/mysql-test/t/mysqlbinlog_row_trans.test +++ /dev/null @@ -1,161 +0,0 @@ -# mysqlbinlog_trans.test -# -# Show that mysqlbinlog work correctly with transactions. -# - -#--source include/have_myisam.inc ---let $engine_type_nontrans= MyISAM ---source include/have_innodb.inc ---let $engine_type= InnoDB - -# -# The test case would also work with statement based or mixed mode logging. -# But this would require different result files. To handle this with the -# current test suite, new main test cases are required. -# ---source include/have_binlog_format_row.inc - ---source include/have_log_bin.inc - ---echo # ---echo # Preparatory cleanup. ---echo # ---disable_warnings -DROP TABLE IF EXISTS t1, t2; ---enable_warnings - ---echo # ---echo # We need a fixed timestamp to avoid varying results. ---echo # -SET timestamp=1000000000; - ---echo # ---echo # Delete all existing binary logs. ---echo # -RESET MASTER; - ---echo # ---echo # Create test tables. ---echo # -eval CREATE TABLE t1 ( - c1 INT, - c2 VARCHAR(20) - ) ENGINE=$engine_type DEFAULT CHARSET latin1; -eval CREATE TABLE t2 ( - c1 INT, - c2 VARCHAR(20) - ) ENGINE=$engine_type_nontrans DEFAULT CHARSET latin1; - ---echo # ---echo # Start transaction #1, transactional table only, commit. ---echo # -START TRANSACTION; - ---echo # ---echo # Do some statements. ---echo # -INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3'); -UPDATE t1 SET c1 = c1 + 10; -DELETE FROM t1 WHERE c1 = 12; - ---echo # ---echo # Commit transaction. ---echo # -COMMIT; -SELECT * FROM t1; -TRUNCATE TABLE t1; - ---echo # ---echo # Start transaction #2, transactional table only, rollback. ---echo # -START TRANSACTION; - ---echo # ---echo # Do some statements. ---echo # -INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3'); -UPDATE t1 SET c1 = c1 + 10; -DELETE FROM t1 WHERE c1 = 12; - ---echo # ---echo # Rollback transaction. ---echo # -ROLLBACK; -SELECT * FROM t1; -TRUNCATE TABLE t1; - ---echo # ---echo # Start transaction #3, both tables, commit. ---echo # -START TRANSACTION; - ---echo # ---echo # Do some statements on the transactional table. ---echo # -INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3'); -UPDATE t1 SET c1 = c1 + 10; -DELETE FROM t1 WHERE c1 = 12; - ---echo # ---echo # Do some statements on the non-transactional table. ---echo # -INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3'); -UPDATE t2 SET c1 = c1 + 10; -DELETE FROM t2 WHERE c1 = 12; - ---echo # ---echo # Commit transaction. ---echo # -COMMIT; -SELECT * FROM t1; -SELECT * FROM t2; -TRUNCATE TABLE t1; -TRUNCATE TABLE t2; - ---echo # ---echo # Start transaction #4, both tables, rollback. ---echo # -START TRANSACTION; - ---echo # ---echo # Do some statements on the transactional table. ---echo # -INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3'); -UPDATE t1 SET c1 = c1 + 10; -DELETE FROM t1 WHERE c1 = 12; - ---echo # ---echo # Do some statements on the non-transactional table. ---echo # -INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3'); -UPDATE t2 SET c1 = c1 + 10; -DELETE FROM t2 WHERE c1 = 12; - ---echo # ---echo # Rollback transaction. ---echo # -ROLLBACK; -SELECT * FROM t1; -SELECT * FROM t2; -TRUNCATE TABLE t1; -TRUNCATE TABLE t2; - ---echo # ---echo # Flush all log buffers to the log file. ---echo # -FLUSH LOGS; - ---echo # ---echo # Call mysqlbinlog to display the log file contents. ---echo # -let $MYSQLD_DATADIR= `select @@datadir`; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 - ---echo # ---echo # Cleanup. ---echo # -DROP TABLE t1, t2; - - diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index 2b234b64047..4412383f837 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -4,14 +4,14 @@ CREATE TABLE t1(a int) ENGINE=EXAMPLE; DROP TABLE t1; -eval INSTALL PLUGIN example SONAME 'ha_example'; +INSTALL PLUGIN example SONAME 'ha_example'; --replace_regex /\.dll/.so/ --error 1125 -eval INSTALL PLUGIN EXAMPLE SONAME 'ha_example'; +INSTALL PLUGIN EXAMPLE SONAME 'ha_example'; UNINSTALL PLUGIN example; -eval INSTALL SONAME 'ha_example'; +INSTALL SONAME 'ha_example'; --replace_column 5 # --replace_regex /\.dll/.so/ --query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%' @@ -28,7 +28,7 @@ set global example_enum_var= e1; show status like 'example%'; show variables like 'example%'; -eval UNINSTALL SONAME 'ha_example'; +UNINSTALL SONAME 'ha_example'; --replace_column 5 # --replace_regex /\.dll/.so/ --query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%' @@ -41,12 +41,18 @@ UNINSTALL PLUGIN EXAMPLE; --error 1305 UNINSTALL PLUGIN non_exist; +# +# MDEV-3985 crash: uninstall soname 'a' +# +--replace_regex /\.dll/.so/ +--error 1305 +UNINSTALL SONAME 'non_exist'; --echo # --echo # Bug#32034: check_func_enum() does not check correct values but set it --echo # to impossible int val --echo # -eval INSTALL PLUGIN example SONAME 'ha_example'; +INSTALL PLUGIN example SONAME 'ha_example'; SET GLOBAL example_enum_var= e1; SET GLOBAL example_enum_var= e2; @@ -60,7 +66,7 @@ UNINSTALL PLUGIN example; # # Bug #32757 hang with sql_mode set when setting some global variables # -eval INSTALL PLUGIN example SONAME 'ha_example'; +INSTALL PLUGIN example SONAME 'ha_example'; select @@session.sql_mode into @old_sql_mode; diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test index 6b121762354..366dc75c425 100644 --- a/mysql-test/t/plugin_auth.test +++ b/mysql-test/t/plugin_auth.test @@ -175,21 +175,35 @@ GRANT PROXY ON ''@'' TO grant_plug; --error ER_ACCESS_DENIED_NO_PASSWORD_ERROR GRANT PROXY ON grant_plug TO grant_plug_dest; ---echo this should fail : same user, but on a different host ---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR +# Security context in THD contains two pairs of (user,host) +# 1. (user,host) pair referring to inbound connection +# 2. (priv_user,priv_host) pair obtained from mysql.user table after doing +# authnetication of incoming connection. +# Granting/revoking proxy privileges, privileges should be checked wrt +# (priv_user, priv_host) tuple that is obtained from mysql.user table +# Following is a valid grant because effective user of connection is +# grant_plug_dest@% and statement is trying to grant proxy on the same +# user. +--echo This is a valid grant GRANT PROXY ON grant_plug_dest TO grant_plug; +REVOKE PROXY ON grant_plug_dest FROM grant_plug; --echo this should work : same user -GRANT PROXY ON grant_plug_dest@localhost TO grant_plug_dest2; -REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug_dest2; +GRANT PROXY ON grant_plug_dest TO grant_plug_dest2; +REVOKE PROXY ON grant_plug_dest FROM grant_plug_dest2; ---echo this should work : same user +# grant_plug_dest@localhost is not the same as grant_plug_dest@% +# so following grant/revoke should fail +--echo this should fail : not the same user +--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR GRANT PROXY ON grant_plug_dest@localhost TO grant_plug WITH GRANT OPTION; +--echo this should fail : not the same user +--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug; --echo this should fail : can't create users --error ER_CANT_CREATE_USER_WITH_GRANT -GRANT PROXY ON grant_plug_dest@localhost TO grant_plug@localhost; +GRANT PROXY ON grant_plug_dest TO grant_plug@localhost; connection default; --echo in default connection diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 3a38b85f1ae..c2edef87d41 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -1371,3 +1371,17 @@ SELECT RELEASE_LOCK('t'); --connection default SET NAMES latin1; + +--echo # +--echo # WL#6454: Deprecate SHOW AUTHORS and SHOW CONTRIBUTORS +--echo # + +--disable_result_log +SHOW AUTHORS; +--enable_result_log +SHOW WARNINGS; + +--disable_result_log +SHOW CONTRIBUTORS; +--enable_result_log +SHOW WARNINGS; diff --git a/mysql-test/t/show_explain.test b/mysql-test/t/show_explain.test index 36274a27edf..051d4b8b5fc 100644 --- a/mysql-test/t/show_explain.test +++ b/mysql-test/t/show_explain.test @@ -8,6 +8,7 @@ drop table if exists t0, t1, t2, t3, t4; drop view if exists v1; --enable_warnings +SET @old_debug= @@session.debug; # # Testcases in this file do not work with embedded server. The reason for this @@ -56,6 +57,7 @@ let $thr1=`select connection_id()`; connect (con1, localhost, root,,); connection con1; let $thr2=`select connection_id()`; +SET @old_debug= @@session.debug; connection default; # SHOW EXPLAIN FOR <idle thread> @@ -73,7 +75,7 @@ let $wait_condition= select State='show_explain_trap' from information_schema.pr # connection con1; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send select count(*) from t1 where a < 100000; connection default; @@ -101,95 +103,102 @@ evalp show explain for $thr2; connection con1; reap; set optimizer_switch= @show_expl_tmp; - +set debug_dbug=@old_debug; --echo # UNION, first branch set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send explain select a from t0 A union select a+1 from t0 B; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; +set debug_dbug=@old_debug; --echo # UNION, second branch set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send explain select a from t0 A union select a+1 from t0 B; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; +set debug_dbug=@old_debug; --echo # Uncorrelated subquery, select set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send select a, (select max(a) from t0 B) from t0 A where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; +set debug_dbug=@old_debug; --echo # Uncorrelated subquery, explain set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send explain select a, (select max(a) from t0 B) from t0 A where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; +set debug_dbug=@old_debug; --echo # correlated subquery, select set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; +set debug_dbug=@old_debug; --echo # correlated subquery, explain set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; +set debug_dbug=@old_debug; --echo # correlated subquery, select, while inside the subquery set @show_explain_probe_select_id=2; # <--- -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; +set debug_dbug=@old_debug; --echo # correlated subquery, explain, while inside the subquery set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; - +set debug_dbug=@old_debug; --echo # correlated subquery, explain, while inside the subquery set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; --source include/wait_condition.inc @@ -197,6 +206,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; +set debug_dbug=@old_debug; # TODO: explain in the parent subuqery when the un-correlated child has been # run (and have done irreversible cleanups) @@ -209,7 +219,7 @@ reap; --echo # I've found experimentally that select_id==2 here... --echo # set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send set @foo= (select max(a) from t0 where sin(a) >0); connection default; --source include/wait_condition.inc @@ -217,64 +227,71 @@ connection default; evalp show explain for $thr2; connection con1; reap; +set debug_dbug=@old_debug; --echo # --echo # Attempt SHOW EXPLAIN for an UPDATE --echo # create table t2 as select a as a, a as dummy from t0 limit 2; set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; --source include/wait_condition.inc --error ER_TARGET_NOT_EXPLAINABLE evalp show explain for $thr2; +--source include/wait_condition.inc --error ER_TARGET_NOT_EXPLAINABLE evalp show explain for $thr2; connection con1; reap; drop table t2; +set debug_dbug=@old_debug; --echo # --echo # Attempt SHOW EXPLAIN for a DELETE --echo # create table t2 as select a as a, a as dummy from t0 limit 2; set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; --source include/wait_condition.inc --error ER_TARGET_NOT_EXPLAINABLE evalp show explain for $thr2; +--source include/wait_condition.inc --error ER_TARGET_NOT_EXPLAINABLE evalp show explain for $thr2; connection con1; reap; drop table t2; - +set debug_dbug=@old_debug; --echo # --echo # Multiple SHOW EXPLAIN calls for one select --echo # create table t2 as select a as a, a as dummy from t0 limit 3; set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2; connection default; --source include/wait_condition.inc evalp show explain for $thr2; +--source include/wait_condition.inc evalp show explain for $thr2; +--source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; drop table t2; +set debug_dbug=@old_debug; --echo # --echo # SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort" --echo # explain select * from t0 order by a; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; send select * from t0 order by a; connection default; @@ -282,6 +299,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; +set debug_dbug=@old_debug; --echo # --echo # SHOW EXPLAIN for SELECT ... with "Using temporary" @@ -290,7 +308,7 @@ connection default; explain select distinct a from t0; connection con1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; send select distinct a from t0; connection default; @@ -298,6 +316,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; +set debug_dbug=@old_debug; --echo # --echo # SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort" @@ -306,7 +325,7 @@ connection default; explain select distinct a from t0; connection con1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; send select distinct a from t0; connection default; @@ -314,7 +333,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; --echo # --echo # MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM subquery and GROUP BY @@ -323,7 +342,7 @@ CREATE TABLE t2 ( a INT ); INSERT INTO t2 VALUES (1),(2),(1),(4),(2); explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a; -set debug_dbug='d,show_explain_in_find_all_keys'; +set debug_dbug='+d,show_explain_in_find_all_keys'; send SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a; connection default; @@ -334,7 +353,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t2; @@ -350,7 +369,7 @@ INSERT INTO t2 VALUES (1),(2),(1),(4),(2); EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; send EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ; connection default; @@ -358,7 +377,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t2; @@ -374,7 +393,7 @@ INSERT INTO t2 VALUES (4),(5),(6),(7),(8),(9); explain SELECT * FROM v1, t2; set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; send SELECT * FROM v1, t2; connection default; @@ -383,7 +402,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; DROP VIEW v1; DROP TABLE t2, t3; @@ -391,21 +410,21 @@ DROP TABLE t2, t3; --echo # MDEV-267: SHOW EXPLAIN: Server crashes in JOIN::print_explain on most of queries --echo # set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; send select sleep(1); connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; --echo # --echo # Same as above, but try another reason for JOIN to be degenerate --echo # set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; send select * from t0 where 1>10; connection default; --source include/wait_condition.inc @@ -413,7 +432,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; --echo # --echo # Same as above, but try another reason for JOIN to be degenerate (2) @@ -421,7 +440,7 @@ set debug_dbug=''; create table t3(a int primary key); insert into t3 select a from t0; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; send select * from t0,t3 where t3.a=112233; connection default; --source include/wait_condition.inc @@ -429,7 +448,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t3; --echo # @@ -448,7 +467,7 @@ explain SELECT * FROM t2 WHERE a = ); set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_do_select'; +set debug_dbug='+d,show_explain_probe_do_select'; send SELECT * FROM t2 WHERE a = (SELECT MAX(a) FROM t2 WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3) @@ -458,7 +477,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t2; @@ -491,7 +510,7 @@ WHERE a1 < ALL ( ); set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_do_select'; +set debug_dbug='+d,show_explain_probe_do_select'; send SELECT count(*) FROM t2, t3 WHERE a1 < ALL ( @@ -504,7 +523,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t2, t3, t4; --echo # @@ -516,7 +535,7 @@ INSERT INTO t2 VALUES (11,23),(12,3),(13,45),(14,16),(15,2),(16,33),(17,2),(18,5),(19,9),(20,2); set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; send SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`); connection default; @@ -525,10 +544,9 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t2; - DROP TABLE t1; --echo # @@ -538,7 +556,7 @@ CREATE TABLE t1(a INT, KEY(a)); INSERT INTO t1 VALUES (3),(1),(5),(1); set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send SELECT 'test' FROM t1 WHERE a=1; connection default; @@ -546,7 +564,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t1; @@ -570,7 +588,7 @@ set join_cache_level=0; explain select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_test_if_quick_select'; +set debug_dbug='+d,show_explain_probe_test_if_quick_select'; send select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100; @@ -587,7 +605,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t1; --echo # @@ -598,7 +616,7 @@ CREATE TABLE t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c)); INSERT INTO t1 (a) VALUES (3),(1),(5),(1); set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send SHOW INDEX FROM t1; connection default; @@ -606,7 +624,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t1; @@ -620,7 +638,7 @@ CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT a + 1 FROM v1; -set debug_dbug='d,show_explain_probe_join_tab_preread'; +set debug_dbug='+d,show_explain_probe_join_tab_preread'; set @show_explain_probe_select_id=1; send @@ -630,7 +648,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; DROP VIEW v1; DROP TABLE t1; @@ -646,7 +664,7 @@ INSERT INTO t1 VALUES (4),(6); EXPLAIN SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ); -set debug_dbug='d,show_explain_probe_union_read'; +set debug_dbug='+d,show_explain_probe_union_read'; send SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ); @@ -660,8 +678,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; - +set debug_dbug=@old_debug; DROP TABLE t1; --echo # @@ -683,7 +700,7 @@ SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b ); set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; --send SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b ); @@ -694,7 +711,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t1, t2; --echo # @@ -717,7 +734,7 @@ insert into t3 select * from t4; explain select distinct t1.a from t1,t3 where t1.a=t3.a; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; --send select distinct t1.a from t1,t3 where t1.a=t3.a; connection default; @@ -726,7 +743,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t1,t3,t4; @@ -744,7 +761,7 @@ connection con1; --echo # First, make sure that user 'test2' cannot do SHOW EXPLAIN on us --echo # set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send select * from t0 where a < 3; @@ -760,7 +777,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; --echo # --echo # Check that user test2 can do SHOW EXPLAIN on its own queries @@ -770,7 +787,7 @@ connect (con3, localhost, test2,,); connection con2; let $thr_con2=`select connection_id()`; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send select * from t0 where a < 3; @@ -796,9 +813,10 @@ disconnect con2; grant process on *.* to test2@localhost; connect (con2, localhost, test2,,); connection con1; +set debug_dbug=@old_debug; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send select * from t0 where a < 3; @@ -810,7 +828,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; revoke all privileges on test.* from test2@localhost; drop user test2@localhost; @@ -890,7 +908,7 @@ WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 ORDER BY b; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; --send SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 @@ -902,9 +920,10 @@ evalp show explain for $thr2; connection con1; reap; +set debug_dbug=@old_debug; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_do_select'; +set debug_dbug='+d,show_explain_probe_do_select'; --send SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 @@ -917,7 +936,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t1; @@ -933,7 +952,7 @@ INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12, t1 t13; EXPLAIN SELECT a FROM t1 GROUP BY a; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; --send SELECT a FROM t1 GROUP BY a; @@ -944,7 +963,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t1; @@ -960,7 +979,7 @@ INSERT INTO t2 VALUES (86,'English'),(87,'Russian'); explain SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's'; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; --send SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's'; @@ -971,8 +990,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; - +set debug_dbug=@old_debug; drop table t1, t2; --echo # @@ -1011,7 +1029,7 @@ explain SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_do_select'; +set debug_dbug='+d,show_explain_probe_do_select'; send SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2; @@ -1023,7 +1041,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t1,t2,t3; @@ -1047,7 +1065,7 @@ SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias @@ -1060,8 +1078,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; - +set debug_dbug=@old_debug; DROP TABLE t1,t2,t3; --echo # @@ -1088,7 +1105,7 @@ select charset('ãû'); select hex('ãû'); set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; send select * from t0 where length('ãû') = a; @@ -1103,7 +1120,7 @@ connection con1; # The constant should be two letters, the last looking like 'bl' reap; -set debug_dbug=''; +set debug_dbug=@old_debug; set names default; --echo # diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 7fc8dad3bb9..9db6709a8d2 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -9151,6 +9151,26 @@ CALL p1(1); DROP PROCEDURE p1; +--echo +--echo MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions in WHERE clause of UPDATE or DELETE statements +--echo + +CREATE FUNCTION tdn() RETURNS int(7) DETERMINISTIC RETURN to_days(now()); + +CREATE TABLE t1 (pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY, daynum INT, a CHAR(1), INDEX(daynum), INDEX(a)) ENGINE=MyISAM; +INSERT INTO t1 (daynum) VALUES (1),(2),(3),(4),(5),(TO_DAYS(NOW())),(7),(8); +INSERT INTO t1 (daynum) SELECT a1.daynum FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5; + +FLUSH TABLES; +FLUSH STATUS; + +SHOW STATUS LIKE '%Handler_read%'; +UPDATE t1 SET a = '+' WHERE daynum=tdn(); +SHOW STATUS LIKE '%Handler_read%'; + +drop function tdn; +drop table t1; + --echo # --echo # lp:1002157 : testing stored function --echo # bug#62125 result for null incorrectly yields 1292 warning. diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test index 39e7102079c..447a1db762e 100644 --- a/mysql-test/t/sp_notembedded.test +++ b/mysql-test/t/sp_notembedded.test @@ -429,14 +429,6 @@ disconnect addcon; DROP DATABASE `my.db`; USE test; -# -# Restore global concurrent_insert value. Keep in the end of the test file. -# - -set @@global.concurrent_insert= @old_concurrent_insert; - -# Wait till all disconnects are completed ---source include/wait_until_count_sessions.inc --echo # --echo # Bug#11763507 - 56224: FUNCTION NAME IS CASE-SENSITIVE @@ -461,3 +453,16 @@ SHOW CREATE EVENT TESTE_bug11763507; DROP EVENT teste_bug11763507; --echo #END OF BUG#11763507 test. + +--echo # ------------------------------------------------------------------ +--echo # -- End of 5.1 tests +--echo # ------------------------------------------------------------------ + +# +# Restore global concurrent_insert value. Keep in the end of the test file. +# + +set @@global.concurrent_insert= @old_concurrent_insert; + +# Wait till all disconnects are completed +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/stat_tables_par.test b/mysql-test/t/stat_tables_par.test index 57b57e3ebba..6c4e1be6e48 100644 --- a/mysql-test/t/stat_tables_par.test +++ b/mysql-test/t/stat_tables_par.test @@ -242,4 +242,37 @@ DROP DATABASE dbt3_s001; use test; +# +# Bug mdev-4019: crash when executing in parallel ANALYZE and +# SELECT * FROM information_schema.statistics +# + +set @save_global_use_stat_tables=@@global.use_stat_tables; +set global use_stat_tables='preferably'; +set debug_sync='RESET'; + +create table t1 (a int, b int, key(a)); +insert t1 values (1,1),(2,2); + +analyze table t1; + +SET debug_sync='after_open_table_ignore_flush WAIT_FOR go'; +send select * from information_schema.statistics where table_schema='test'; + +connect(con1, localhost, root); +connection con1; +select * from t1; +SET DEBUG_SYNC= "now SIGNAL go"; + +connection default; +reap; + +connection default; +disconnect con1; +set debug_sync='RESET'; + +drop table t1; +set global use_stat_tables=@save_global_use_stat_tables; + + set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index 14b62bfd2f7..37f660d6682 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -1778,6 +1778,57 @@ drop table t1, t2; set optimizer_switch=@subselect4_tmp; --echo # +--echo # MDEV-3928 Assertion `example' failed in Item_cache::is_expensive_processor with a 2-level IN subquery +--echo # + +CREATE TABLE t1 (a1 INT, b1 TIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4,'21:22:34'),(6,'10:50:38'); + +CREATE TABLE t2 (a2 INT, b2 TIME) ENGINE=MyISAM; +INSERT INTO t2 VALUES (8, '06:17:39'); + +CREATE TABLE t3 (a3 INT, b3 TIME) ENGINE=MyISAM; +INSERT INTO t3 VALUES (1,'00:00:01'),(7,'00:00:02'); + +EXPLAIN +SELECT * FROM t1 WHERE a1 IN ( + SELECT a2 FROM t2 WHERE a2 IN ( + SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3 + ) +); + +SELECT * FROM t1 WHERE a1 IN ( + SELECT a2 FROM t2 WHERE a2 IN ( + SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3 + ) +); +drop table t1, t2, t3; + +--echo # +--echo # MDEV-4056:Server crashes in Item_func_trig_cond::val_int +--echo # with FROM and NOT IN subqueries, LEFT JOIN, derived_merge+in_to_exists +--echo # + +set @optimizer_switch_MDEV4056 = @@optimizer_switch; +SET optimizer_switch = 'derived_merge=on,in_to_exists=on'; + +CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('x'),('d'); + +CREATE TABLE t2 (pk INT PRIMARY KEY, b INT, c VARCHAR(1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2,'v'),(2,150,'v'); + +SELECT * FROM t1 LEFT JOIN ( + SELECT * FROM t2 WHERE ( pk, pk ) NOT IN ( + SELECT MIN(b), SUM(pk) FROM t1 + ) +) AS alias1 ON (a = c) +WHERE b IS NULL OR a < 'u'; + +drop table t1,t2; +set @@optimizer_switch = @optimizer_switch_MDEV4056; + +--echo # --echo # MDEV-3899 Valgrind warnings (blocks are definitely lost) in filesort on IN subquery with SUM and DISTINCT --echo # diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test index 523e1774a9c..fc07a088a15 100644 --- a/mysql-test/t/subselect_innodb.test +++ b/mysql-test/t/subselect_innodb.test @@ -425,4 +425,18 @@ select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 gr drop table t1; +--echo # +--echo # MDEV-3988 crash in create_tmp_table +--echo # + +drop table if exists `t1`,`t2`; +create table `t1`(`a` char(1) character set utf8)engine=innodb; +create table `t2`(`b` char(1) character set utf8)engine=memory; +select distinct (select 1 from `t2` where `a`) `d2` from `t1`; +select distinct (select 1 from `t2` where `a`) `d2`, a from `t1`; +select distinct a, (select 1 from `t2` where `a`) `d2` from `t1`; +select distinct (1 + (select 1 from `t2` where `a`)) `d2` from `t1`; + +drop table t1,t2; + set optimizer_switch=@subselect_innodb_tmp; diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test index 2facb089718..efbd2b00f24 100644 --- a/mysql-test/t/subselect_sj.test +++ b/mysql-test/t/subselect_sj.test @@ -2462,5 +2462,74 @@ HAVING t1sum <> 1; DROP TABLE t1, t2; +--echo # +--echo # MDEV-3911: Assertion `fixed == 0' failed in Item_field::fix_fields +--echo # on 2nd execution of PS with semijoin=on and IN subquery +--echo # + +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0,4),(8,6); + +CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (7,1),(0,7); + +eval PREPARE stmt FROM ' SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) '; + +execute stmt; +execute stmt; + +deallocate prepare stmt; +drop table t1,t2; + +--echo # +--echo # MySQL Bug#13340270: assertion table->sort.record_pointers == __null +--echo # + +CREATE TABLE t1 ( + pk int NOT NULL, + col_int_key int DEFAULT NULL, + col_varchar_key varchar(1) DEFAULT NULL, + col_varchar_nokey varchar(1) DEFAULT NULL, + PRIMARY KEY (pk), + KEY col_int_key (col_int_key), + KEY col_varchar_key (col_varchar_key, col_int_key) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES +(10,8,'x','x'), +(11,7,'d','d'), +(12,1,'r','r'), +(13,7,'f','f'), +(14,9,'y','y'), +(15,NULL,'u','u'), +(16,1,'m','m'), +(17,9,NULL,NULL), +(18,2,'o','o'), +(19,9,'w','w'), +(20,2,'m','m'), +(21,4,'q','q'); + +let $query= + SELECT alias1.col_varchar_nokey AS field1 + FROM t1 AS alias1 JOIN t1 AS alias2 + ON alias2.col_int_key = alias1.pk OR + alias2.col_int_key = alias1.col_int_key + WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o' +; + +eval CREATE TABLE t2 + $query +; + +eval EXPLAIN SELECT * +FROM t2 +WHERE (field1) IN ($query); + +eval SELECT * +FROM t2 +WHERE (field1) IN ($query); + +DROP TABLE t1, t2; + # The following command must be the last one the file set optimizer_switch=@subselect_sj_tmp; diff --git a/mysql-test/t/sum_distinct-big.test b/mysql-test/t/sum_distinct-big.test index 0859f4b3d89..d3710056c9a 100644 --- a/mysql-test/t/sum_distinct-big.test +++ b/mysql-test/t/sum_distinct-big.test @@ -63,5 +63,22 @@ SELECT SUM(DISTINCT id) sm FROM t1; SELECT SUM(DISTINCT id) sm FROM t2; SELECT SUM(DISTINCT id) sm FROM t1 GROUP BY id % 13; +--echo # +--echo # Bug mdev-4063: SUM(DISTINCT...) with small'max_heap_table_size +--echo # (bug #56927) +--echo # + +SET max_heap_table_size=default; + +INSERT INTO t1 SELECT id+16384 FROM t1; +DELETE FROM t2; +INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand(); + +SELECT SUM(DISTINCT id) sm FROM t2; + +SET max_heap_table_size=16384; + +SELECT SUM(DISTINCT id) sm FROM t2; + DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index c6c4e4d9d2f..c6930a7e468 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -452,4 +452,18 @@ SELECT DISTINCT POW(COUNT(distinct a), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 SELECT @a; DROP TABLE t1; +--echo # +--echo # Check that used memory extends if we set a variable +--echo # + +# Execute twice so number stablizes a bit +let $tmp= `select memory_used from information_schema.processlist`; +set @var= repeat('a',20000); +let $tmp2= `select memory_used from information_schema.processlist`; +--disable_query_log +--disable_column_names +eval select $tmp < $tmp2; +--enable_column_names +--enable_query_log + --echo End of 5.5 tests diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 072a179e822..4569443dbac 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -4703,6 +4703,32 @@ drop view v2; drop table t1,t2; --echo # +--echo # MDEV-3914: Wrong result (NULLs instead of real values) +--echo # with INNER and RIGHT JOIN in a FROM subquery, derived_merge=on +--echo # (fix of above MDEV-486 fix) +--echo # +SET @save_optimizer_switch_MDEV_3914=@@optimizer_switch; +SET optimizer_switch = 'derived_merge=on'; + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); + +CREATE TABLE t3 (c INT) ENGINE=MyISAM; +INSERT INTO t3 VALUES (5),(6); + +SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias; + +SET optimizer_switch = 'derived_merge=off'; + +SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias; + +SET optimizer_switch=@save_optimizer_switch_MDEV_3914; +drop table t1,t2,t3; + +--echo # --echo # MDEV-589 (LP BUG#1007647) : --echo # Assertion `vcol_table == 0 || vcol_table == table' failed in --echo # fill_record(THD*, List<Item>&, List<Item>&, bool) @@ -4747,6 +4773,27 @@ SELECT * FROM ( drop tables t1,t2; +--echo # +--echo # MDEV-3876 Wrong result (extra rows) with ALL subquery +--echo # from a MERGE view (duplicate of MDEV-3873) +--echo # + +CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(3); + +CREATE OR REPLACE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t2; + +SELECT a FROM t1 AS alias +WHERE a >= ALL ( +SELECT b FROM t1 LEFT JOIN v1 ON (a = b) +WHERE a = alias.a ); + +drop view v1; +drop table t1,t2; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.3 tests. --echo # ----------------------------------------------------------------- |