summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-09-24 02:32:34 +0300
committerunknown <monty@mysql.com>2005-09-24 02:32:34 +0300
commita51f78320e1e49f1d0bf8508d8779042f95ac0c8 (patch)
treec025ded7f6e08868c3adfb858778c44b0e13bc05 /mysql-test
parent381fe39e783174c54401ee4f9bd21789a9cdb3bb (diff)
parent5559c48e182e40cfd052a29e875514761994333d (diff)
downloadmariadb-git-a51f78320e1e49f1d0bf8508d8779042f95ac0c8.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_group.result136
-rw-r--r--mysql-test/r/func_in.result9
-rw-r--r--mysql-test/r/loaddata.result10
-rw-r--r--mysql-test/r/myisam.result4
-rw-r--r--mysql-test/r/ndb_alter_table.result116
-rw-r--r--mysql-test/r/update.result12
-rw-r--r--mysql-test/t/func_group.test69
-rw-r--r--mysql-test/t/func_in.test7
-rw-r--r--mysql-test/t/loaddata.test27
-rw-r--r--mysql-test/t/ndb_alter_table.test119
-rw-r--r--mysql-test/t/update.test12
11 files changed, 519 insertions, 2 deletions
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 2fb18ca92c7..67966b999d4 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -780,3 +780,139 @@ SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
MAX(id)
NULL
DROP TABLE t1;
+create table t1m (a int) engine=myisam;
+create table t1i (a int) engine=innodb;
+create table t2m (a int) engine=myisam;
+create table t2i (a int) engine=innodb;
+insert into t2m values (5);
+insert into t2i values (5);
+select min(a) from t1m;
+min(a)
+NULL
+select min(7) from t1m;
+min(7)
+NULL
+select min(7) from DUAL;
+min(7)
+NULL
+explain select min(7) from t2m join t1m;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(7) from t2m join t1m;
+min(7)
+NULL
+select max(a) from t1m;
+max(a)
+NULL
+select max(7) from t1m;
+max(7)
+NULL
+select max(7) from DUAL;
+max(7)
+NULL
+explain select max(7) from t2m join t1m;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(7) from t2m join t1m;
+max(7)
+NULL
+select 1, min(a) from t1m where a=99;
+1 min(a)
+1 NULL
+select 1, min(a) from t1m where 1=99;
+1 min(a)
+1 NULL
+select 1, min(1) from t1m where a=99;
+1 min(1)
+select 1, min(1) from t1m where 1=99;
+1 min(1)
+1 NULL
+select 1, max(a) from t1m where a=99;
+1 max(a)
+1 NULL
+select 1, max(a) from t1m where 1=99;
+1 max(a)
+1 NULL
+select 1, max(1) from t1m where a=99;
+1 max(1)
+select 1, max(1) from t1m where 1=99;
+1 max(1)
+1 NULL
+select min(a) from t1i;
+min(a)
+NULL
+select min(7) from t1i;
+min(7)
+NULL
+select min(7) from DUAL;
+min(7)
+NULL
+explain select min(7) from t2i join t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select min(7) from t2i join t1i;
+min(7)
+NULL
+select max(a) from t1i;
+max(a)
+NULL
+select max(7) from t1i;
+max(7)
+NULL
+select max(7) from DUAL;
+max(7)
+NULL
+explain select max(7) from t2i join t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select max(7) from t2i join t1i;
+max(7)
+NULL
+select 1, min(a) from t1i where a=99;
+1 min(a)
+1 NULL
+select 1, min(a) from t1i where 1=99;
+1 min(a)
+1 NULL
+select 1, min(1) from t1i where a=99;
+1 min(1)
+1 NULL
+select 1, min(1) from t1i where 1=99;
+1 min(1)
+1 NULL
+select 1, max(a) from t1i where a=99;
+1 max(a)
+1 NULL
+select 1, max(a) from t1i where 1=99;
+1 max(a)
+1 NULL
+select 1, max(1) from t1i where a=99;
+1 max(1)
+1 NULL
+select 1, max(1) from t1i where 1=99;
+1 max(1)
+1 NULL
+explain select count(*), min(7), max(7) from t1m, t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select count(*), min(7), max(7) from t1m, t1i;
+count(*) min(7) max(7)
+0 NULL NULL
+explain select count(*), min(7), max(7) from t1m, t2i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1
+select count(*), min(7), max(7) from t1m, t2i;
+count(*) min(7) max(7)
+0 NULL NULL
+explain select count(*), min(7), max(7) from t2m, t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2m system NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select count(*), min(7), max(7) from t2m, t1i;
+count(*) min(7) max(7)
+0 NULL NULL
+drop table t1m, t1i, t2m, t2i;
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index 516d0a28a21..3cf2afc83d1 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -193,3 +193,12 @@ select * from t1 where a in (NULL, 'aa');
a
aa
drop table t1;
+create table t1 (id int, key(id));
+insert into t1 values (1),(2),(3);
+select count(*) from t1 where id not in (1);
+count(*)
+2
+select count(*) from t1 where id not in (1,2);
+count(*)
+1
+drop table t1;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index c0baabcc507..46db14a5871 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -66,3 +66,13 @@ a b
3 row 3
0
drop table t1;
+SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+create table t1(id integer not null auto_increment primary key);
+insert into t1 values(0);
+select * from t1;
+id
+0
+select * from t1;
+id
+0
+SET @@SQL_MODE=@OLD_SQL_MODE;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index b3144a6903b..0a6f3ddc28b 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -611,7 +611,7 @@ test.t2 984116287
drop table t1, t2;
show variables like 'myisam_stats_method';
Variable_name Value
-myisam_stats_method nulls_inequal
+myisam_stats_method nulls_unequal
create table t1 (a int, key(a));
insert into t1 values (0),(1),(2),(3),(4);
insert into t1 select NULL from t1;
@@ -652,7 +652,7 @@ t1 1 a 1 a A 5 NULL NULL YES BTREE
set myisam_stats_method=DEFAULT;
show variables like 'myisam_stats_method';
Variable_name Value
-myisam_stats_method nulls_inequal
+myisam_stats_method nulls_unequal
insert into t1 values (11);
delete from t1 where a=11;
analyze table t1;
diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result
index 63afc07718f..3714ea14e16 100644
--- a/mysql-test/r/ndb_alter_table.result
+++ b/mysql-test/r/ndb_alter_table.result
@@ -200,3 +200,119 @@ a
drop table t4;
show tables;
Tables_in_test
+create table t1 (
+ai bigint auto_increment,
+c001 int(11) not null,
+c002 int(11) not null,
+c003 int(11) not null,
+c004 int(11) not null,
+c005 int(11) not null,
+c006 int(11) not null,
+c007 int(11) not null,
+c008 int(11) not null,
+c009 int(11) not null,
+c010 int(11) not null,
+c011 int(11) not null,
+c012 int(11) not null,
+c013 int(11) not null,
+c014 int(11) not null,
+c015 int(11) not null,
+c016 int(11) not null,
+c017 int(11) not null,
+c018 int(11) not null,
+c019 int(11) not null,
+c020 int(11) not null,
+c021 int(11) not null,
+c022 int(11) not null,
+c023 int(11) not null,
+c024 int(11) not null,
+c025 int(11) not null,
+c026 int(11) not null,
+c027 int(11) not null,
+c028 int(11) not null,
+c029 int(11) not null,
+c030 int(11) not null,
+c031 int(11) not null,
+c032 int(11) not null,
+c033 int(11) not null,
+c034 int(11) not null,
+c035 int(11) not null,
+c036 int(11) not null,
+c037 int(11) not null,
+c038 int(11) not null,
+c039 int(11) not null,
+c040 int(11) not null,
+c041 int(11) not null,
+c042 int(11) not null,
+c043 int(11) not null,
+c044 int(11) not null,
+c045 int(11) not null,
+c046 int(11) not null,
+c047 int(11) not null,
+c048 int(11) not null,
+c049 int(11) not null,
+c050 int(11) not null,
+c051 int(11) not null,
+c052 int(11) not null,
+c053 int(11) not null,
+c054 int(11) not null,
+c055 int(11) not null,
+c056 int(11) not null,
+c057 int(11) not null,
+c058 int(11) not null,
+c059 int(11) not null,
+c060 int(11) not null,
+c061 int(11) not null,
+c062 int(11) not null,
+c063 int(11) not null,
+c064 int(11) not null,
+c065 int(11) not null,
+c066 int(11) not null,
+c067 int(11) not null,
+c068 int(11) not null,
+c069 int(11) not null,
+c070 int(11) not null,
+c071 int(11) not null,
+c072 int(11) not null,
+c073 int(11) not null,
+c074 int(11) not null,
+c075 int(11) not null,
+c076 int(11) not null,
+c077 int(11) not null,
+c078 int(11) not null,
+c079 int(11) not null,
+c080 int(11) not null,
+c081 int(11) not null,
+c082 int(11) not null,
+c083 int(11) not null,
+c084 int(11) not null,
+c085 int(11) not null,
+c086 int(11) not null,
+c087 int(11) not null,
+c088 int(11) not null,
+c089 int(11) not null,
+c090 int(11) not null,
+c091 int(11) not null,
+c092 int(11) not null,
+c093 int(11) not null,
+c094 int(11) not null,
+c095 int(11) not null,
+c096 int(11) not null,
+c097 int(11) not null,
+c098 int(11) not null,
+c099 int(11) not null,
+c100 int(11) not null,
+c101 int(11) not null,
+c102 int(11) not null,
+c103 int(11) not null,
+c104 int(11) not null,
+c105 int(11) not null,
+c106 int(11) not null,
+c107 int(11) not null,
+c108 int(11) not null,
+c109 int(11) not null,
+primary key (ai),
+unique key tx1 (c002, c003, c004, c005)) engine=ndb;
+create index tx2
+on t1 (c010, c011, c012, c013);
+drop table t1;
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index e35d4e29fe4..d6c1118f90c 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -251,3 +251,15 @@ f1 f2
1 1
2 2
drop table t1,t2;
+create table t1(f1 int);
+select DATABASE();
+DATABASE()
+test
+update t1 set f1=1 where count(*)=1;
+ERROR HY000: Invalid use of group function
+select DATABASE();
+DATABASE()
+test
+delete from t1 where count(*)=1;
+ERROR HY000: Invalid use of group function
+drop table t1;
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 4dc8d66c4f1..f833f482f73 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -527,4 +527,73 @@ INSERT INTO t1 VALUES
SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
DROP TABLE t1;
+#
+# Bug #12882 min/max inconsistent on empty table
+#
+
+create table t1m (a int) engine=myisam;
+create table t1i (a int) engine=innodb;
+create table t2m (a int) engine=myisam;
+create table t2i (a int) engine=innodb;
+insert into t2m values (5);
+insert into t2i values (5);
+
+# test with MyISAM
+select min(a) from t1m;
+select min(7) from t1m;
+select min(7) from DUAL;
+explain select min(7) from t2m join t1m;
+select min(7) from t2m join t1m;
+
+select max(a) from t1m;
+select max(7) from t1m;
+select max(7) from DUAL;
+explain select max(7) from t2m join t1m;
+select max(7) from t2m join t1m;
+
+select 1, min(a) from t1m where a=99;
+select 1, min(a) from t1m where 1=99;
+select 1, min(1) from t1m where a=99;
+select 1, min(1) from t1m where 1=99;
+
+select 1, max(a) from t1m where a=99;
+select 1, max(a) from t1m where 1=99;
+select 1, max(1) from t1m where a=99;
+select 1, max(1) from t1m where 1=99;
+
+# test with InnoDB
+select min(a) from t1i;
+select min(7) from t1i;
+select min(7) from DUAL;
+explain select min(7) from t2i join t1i;
+select min(7) from t2i join t1i;
+
+select max(a) from t1i;
+select max(7) from t1i;
+select max(7) from DUAL;
+explain select max(7) from t2i join t1i;
+select max(7) from t2i join t1i;
+
+select 1, min(a) from t1i where a=99;
+select 1, min(a) from t1i where 1=99;
+select 1, min(1) from t1i where a=99;
+select 1, min(1) from t1i where 1=99;
+
+select 1, max(a) from t1i where a=99;
+select 1, max(a) from t1i where 1=99;
+select 1, max(1) from t1i where a=99;
+select 1, max(1) from t1i where 1=99;
+
+# mixed MyISAM/InnoDB test
+explain select count(*), min(7), max(7) from t1m, t1i;
+select count(*), min(7), max(7) from t1m, t1i;
+
+explain select count(*), min(7), max(7) from t1m, t2i;
+select count(*), min(7), max(7) from t1m, t2i;
+
+explain select count(*), min(7), max(7) from t2m, t1i;
+select count(*), min(7), max(7) from t2m, t1i;
+
+drop table t1m, t1i, t2m, t2i;
+
# End of 4.1 tests
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index aec2de7a467..2ffe5a2d5f7 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -102,4 +102,11 @@ insert into t1 values ('aa'), ('bb');
select * from t1 where a in (NULL, 'aa');
drop table t1;
+# BUG#13419
+create table t1 (id int, key(id));
+insert into t1 values (1),(2),(3);
+select count(*) from t1 where id not in (1);
+select count(*) from t1 where id not in (1,2);
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 689bdbbf92d..86fbdc62702 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -31,4 +31,31 @@ load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated
select * from t1;
drop table t1;
+
+#
+# Bug #12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
+#
+SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+create table t1(id integer not null auto_increment primary key);
+insert into t1 values(0);
+disable_query_log;
+eval SELECT * INTO OUTFILE '$MYSQL_TEST_DIR/var/tmp/t1' from t1;
+delete from t1;
+eval load data infile '$MYSQL_TEST_DIR/var/tmp/t1' into table t1;
+enable_query_log;
+select * from t1;
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1
+
+disable_query_log;
+eval SELECT * INTO OUTFILE '$MYSQL_TEST_DIR/var/tmp/t1'
+FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'
+FROM t1;
+delete from t1;
+eval load data infile '$MYSQL_TEST_DIR/var/tmp/t1' into table t1
+FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n';
+enable_query_log;
+select * from t1;
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1
+SET @@SQL_MODE=@OLD_SQL_MODE;
+
# End of 4.1 tests
diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test
index b5b73ad1998..5c792f76316 100644
--- a/mysql-test/t/ndb_alter_table.test
+++ b/mysql-test/t/ndb_alter_table.test
@@ -199,4 +199,123 @@ drop table t4;
show tables;
connection server1;
+create table t1 (
+ai bigint auto_increment,
+c001 int(11) not null,
+c002 int(11) not null,
+c003 int(11) not null,
+c004 int(11) not null,
+c005 int(11) not null,
+c006 int(11) not null,
+c007 int(11) not null,
+c008 int(11) not null,
+c009 int(11) not null,
+c010 int(11) not null,
+c011 int(11) not null,
+c012 int(11) not null,
+c013 int(11) not null,
+c014 int(11) not null,
+c015 int(11) not null,
+c016 int(11) not null,
+c017 int(11) not null,
+c018 int(11) not null,
+c019 int(11) not null,
+c020 int(11) not null,
+c021 int(11) not null,
+c022 int(11) not null,
+c023 int(11) not null,
+c024 int(11) not null,
+c025 int(11) not null,
+c026 int(11) not null,
+c027 int(11) not null,
+c028 int(11) not null,
+c029 int(11) not null,
+c030 int(11) not null,
+c031 int(11) not null,
+c032 int(11) not null,
+c033 int(11) not null,
+c034 int(11) not null,
+c035 int(11) not null,
+c036 int(11) not null,
+c037 int(11) not null,
+c038 int(11) not null,
+c039 int(11) not null,
+c040 int(11) not null,
+c041 int(11) not null,
+c042 int(11) not null,
+c043 int(11) not null,
+c044 int(11) not null,
+c045 int(11) not null,
+c046 int(11) not null,
+c047 int(11) not null,
+c048 int(11) not null,
+c049 int(11) not null,
+c050 int(11) not null,
+c051 int(11) not null,
+c052 int(11) not null,
+c053 int(11) not null,
+c054 int(11) not null,
+c055 int(11) not null,
+c056 int(11) not null,
+c057 int(11) not null,
+c058 int(11) not null,
+c059 int(11) not null,
+c060 int(11) not null,
+c061 int(11) not null,
+c062 int(11) not null,
+c063 int(11) not null,
+c064 int(11) not null,
+c065 int(11) not null,
+c066 int(11) not null,
+c067 int(11) not null,
+c068 int(11) not null,
+c069 int(11) not null,
+c070 int(11) not null,
+c071 int(11) not null,
+c072 int(11) not null,
+c073 int(11) not null,
+c074 int(11) not null,
+c075 int(11) not null,
+c076 int(11) not null,
+c077 int(11) not null,
+c078 int(11) not null,
+c079 int(11) not null,
+c080 int(11) not null,
+c081 int(11) not null,
+c082 int(11) not null,
+c083 int(11) not null,
+c084 int(11) not null,
+c085 int(11) not null,
+c086 int(11) not null,
+c087 int(11) not null,
+c088 int(11) not null,
+c089 int(11) not null,
+c090 int(11) not null,
+c091 int(11) not null,
+c092 int(11) not null,
+c093 int(11) not null,
+c094 int(11) not null,
+c095 int(11) not null,
+c096 int(11) not null,
+c097 int(11) not null,
+c098 int(11) not null,
+c099 int(11) not null,
+c100 int(11) not null,
+c101 int(11) not null,
+c102 int(11) not null,
+c103 int(11) not null,
+c104 int(11) not null,
+c105 int(11) not null,
+c106 int(11) not null,
+c107 int(11) not null,
+c108 int(11) not null,
+c109 int(11) not null,
+primary key (ai),
+unique key tx1 (c002, c003, c004, c005)) engine=ndb;
+
+create index tx2
+on t1 (c010, c011, c012, c013);
+
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index e4e751862f1..84e9ced2017 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -215,4 +215,16 @@ UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1);
select * from t1;
drop table t1,t2;
+#
+# Bug #13180 sometimes server accepts sum func in update/delete where condition
+#
+create table t1(f1 int);
+select DATABASE();
+--error 1111
+update t1 set f1=1 where count(*)=1;
+select DATABASE();
+--error 1111
+delete from t1 where count(*)=1;
+drop table t1;
+
# End of 4.1 tests