summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-05-16 14:24:29 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-05-16 14:24:29 +0300
commit3d56adbfac394b2b3ffd22a89fe7c2978ed9a505 (patch)
tree20d568348fb9aab84446988823f1a971f45a7aca /mysql-test/main
parentb7d22a843e36cd5b8695f8ac2b92789d1cf50e4f (diff)
parent796486d19b7eede58566620dfd110d24ac723218 (diff)
downloadmariadb-git-3d56adbfac394b2b3ffd22a89fe7c2978ed9a505.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/mysqldump.result18
-rw-r--r--mysql-test/main/mysqldump.test29
-rw-r--r--mysql-test/main/stat_tables.result30
-rw-r--r--mysql-test/main/stat_tables.test26
-rw-r--r--mysql-test/main/stat_tables_innodb.result30
5 files changed, 133 insertions, 0 deletions
diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result
index 812a095d1bb..539f51c24e2 100644
--- a/mysql-test/main/mysqldump.result
+++ b/mysql-test/main/mysqldump.result
@@ -5639,6 +5639,24 @@ DROP FUNCTION f;
DROP VIEW v1;
DROP FUNCTION f;
#
+# MDEV-788 New option to ignore foreign key contraints in mysqlimport
+#
+create table t1 (
+id int primary key
+) engine=InnoDB;
+create table t2 (
+t1_id int,
+CONSTRAINT fk
+FOREIGN KEY (t1_id) REFERENCES t1 (id)
+) ENGINE = InnoDB;
+select count(*) from t2;
+count(*)
+1
+select count(*) from t2;
+count(*)
+2
+drop tables t2, t1;
+#
# Test for --add-drop-trigger
#
use test;
diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test
index dbd32f3e74a..8853002b6c0 100644
--- a/mysql-test/main/mysqldump.test
+++ b/mysql-test/main/mysqldump.test
@@ -2500,6 +2500,7 @@ DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db_20772273;
USE test;
+--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt
--echo #
--echo # Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
@@ -2669,6 +2670,34 @@ DROP VIEW v1;
DROP FUNCTION f;
--echo #
+--echo # MDEV-788 New option to ignore foreign key contraints in mysqlimport
+--echo #
+create table t1 (
+ id int primary key
+) engine=InnoDB;
+
+create table t2 (
+ t1_id int,
+ CONSTRAINT fk
+ FOREIGN KEY (t1_id) REFERENCES t1 (id)
+) ENGINE = InnoDB;
+
+--write_file $MYSQLTEST_VARDIR/tmp/t2.txt
+0
+EOF
+
+--error 1
+--exec $MYSQL_IMPORT --silent test $MYSQLTEST_VARDIR/tmp/t2.txt
+--exec $MYSQL_IMPORT --silent -k test $MYSQLTEST_VARDIR/tmp/t2.txt
+select count(*) from t2;
+
+--exec $MYSQL_IMPORT --silent --ignore-foreign-keys test $MYSQLTEST_VARDIR/tmp/t2.txt
+select count(*) from t2;
+
+--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt
+drop tables t2, t1;
+
+--echo #
--echo # Test for --add-drop-trigger
--echo #
use test;
diff --git a/mysql-test/main/stat_tables.result b/mysql-test/main/stat_tables.result
index d224286056f..a631aab8714 100644
--- a/mysql-test/main/stat_tables.result
+++ b/mysql-test/main/stat_tables.result
@@ -707,8 +707,38 @@ ERROR 42S02: Table 'test.x' doesn't exist
select * from information_schema.tables where table_name='v';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY
def test v VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1,t2;
drop view v;
+#
+# MDEV-19407: Assertion `field->table->stats_is_read' failed in is_eits_usable
+#
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity= 1;
+set @@use_stat_tables='never';
+create table t1(pk int);
+insert into t1 values (4),(3);
+set @@optimizer_use_condition_selectivity= 4;
+set use_stat_tables='preferably';
+INSERT INTO t1 SELECT * FROM x;
+ERROR 42S02: Table 'test.x' doesn't exist
+CREATE TABLE t2 SELECT pk FROM t1 WHERE pk>2;
+select * from t2;
+pk
+4
+3
+drop table t1,t2;
+create table t1(a int,b int, key k1(a) );
+insert into t1 values(1,1),(2,2),(3,3);
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+select * from mysql.index_stats, t1 where index_name='k1' and t1.a > 1 and t1.b > 1;
+db_name table_name index_name prefix_arity avg_frequency a b
+test t1 k1 1 1.0000 2 2
+test t1 k1 1 1.0000 3 3
+drop table t1;
set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set @save_optimizer_switch=@@optimizer_switch;
set use_stat_tables=@save_use_stat_tables;
diff --git a/mysql-test/main/stat_tables.test b/mysql-test/main/stat_tables.test
index ddf881c69ae..79a7a17550b 100644
--- a/mysql-test/main/stat_tables.test
+++ b/mysql-test/main/stat_tables.test
@@ -469,9 +469,35 @@ CREATE VIEW v AS SELECT * FROM t1 JOIN t2;
INSERT INTO t2 SELECT * FROM x;
select * from information_schema.tables where table_name='v';
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1,t2;
drop view v;
+
+--echo #
+--echo # MDEV-19407: Assertion `field->table->stats_is_read' failed in is_eits_usable
+--echo #
+
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity= 1;
+set @@use_stat_tables='never';
+create table t1(pk int);
+insert into t1 values (4),(3);
+set @@optimizer_use_condition_selectivity= 4;
+set use_stat_tables='preferably';
+
+--error ER_NO_SUCH_TABLE
+INSERT INTO t1 SELECT * FROM x;
+CREATE TABLE t2 SELECT pk FROM t1 WHERE pk>2;
+select * from t2;
+drop table t1,t2;
+
+create table t1(a int,b int, key k1(a) );
+insert into t1 values(1,1),(2,2),(3,3);
+analyze table t1;
+select * from mysql.index_stats, t1 where index_name='k1' and t1.a > 1 and t1.b > 1;
+drop table t1;
+
set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set @save_optimizer_switch=@@optimizer_switch;
diff --git a/mysql-test/main/stat_tables_innodb.result b/mysql-test/main/stat_tables_innodb.result
index 1d7e1b8f1b6..53a1441158a 100644
--- a/mysql-test/main/stat_tables_innodb.result
+++ b/mysql-test/main/stat_tables_innodb.result
@@ -734,8 +734,38 @@ ERROR 42S02: Table 'test.x' doesn't exist
select * from information_schema.tables where table_name='v';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY
def test v VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1,t2;
drop view v;
+#
+# MDEV-19407: Assertion `field->table->stats_is_read' failed in is_eits_usable
+#
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity= 1;
+set @@use_stat_tables='never';
+create table t1(pk int);
+insert into t1 values (4),(3);
+set @@optimizer_use_condition_selectivity= 4;
+set use_stat_tables='preferably';
+INSERT INTO t1 SELECT * FROM x;
+ERROR 42S02: Table 'test.x' doesn't exist
+CREATE TABLE t2 SELECT pk FROM t1 WHERE pk>2;
+select * from t2;
+pk
+4
+3
+drop table t1,t2;
+create table t1(a int,b int, key k1(a) );
+insert into t1 values(1,1),(2,2),(3,3);
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+select * from mysql.index_stats, t1 where index_name='k1' and t1.a > 1 and t1.b > 1;
+db_name table_name index_name prefix_arity avg_frequency a b
+test t1 k1 1 1.0000 2 2
+test t1 k1 1 1.0000 3 3
+drop table t1;
set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set @save_optimizer_switch=@@optimizer_switch;
set use_stat_tables=@save_use_stat_tables;