summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/alter_table.test28
-rw-r--r--mysql-test/t/constraints.test44
-rw-r--r--mysql-test/t/foreign_key.test72
-rw-r--r--mysql-test/t/gis.test45
-rw-r--r--mysql-test/t/group_min_max.test19
-rw-r--r--mysql-test/t/ipv4_as_ipv6.test3
-rw-r--r--mysql-test/t/ipv4_as_ipv6_win-master.opt1
-rw-r--r--mysql-test/t/ipv4_as_ipv6_win.test31
-rw-r--r--mysql-test/t/ipv6.test43
-rw-r--r--mysql-test/t/ipv6_win-master.opt1
-rw-r--r--mysql-test/t/ipv6_win.test39
-rw-r--r--mysql-test/t/show_profile.test18
12 files changed, 226 insertions, 118 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 2bfe6dbaa62..54c662bccf2 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1089,3 +1089,31 @@ ALTER TABLE t1
ADD i INT UNSIGNED NOT NULL AUTO_INCREMENT,
AUTO_INCREMENT = 1;
DROP TABLE t1;
+
+
+#
+# Bug#50542 5.5.x doesn't check length of key prefixes:
+# corruption and crash results
+#
+# This case is related to Bug#31031 (above)
+# A statement where the index key is larger/wider than
+# the column type, should cause an error
+#
+--error ER_WRONG_SUB_KEY
+CREATE TABLE t1 (a CHAR(1), PRIMARY KEY (a(255)));
+
+# Test other variants of creating indices
+CREATE TABLE t1 (a CHAR(1));
+# ALTER TABLE
+--error ER_WRONG_SUB_KEY
+ALTER TABLE t1 ADD PRIMARY KEY (a(20));
+--error ER_WRONG_SUB_KEY
+ALTER TABLE t1 ADD KEY (a(20));
+# CREATE INDEX
+--error ER_WRONG_SUB_KEY
+CREATE UNIQUE INDEX i1 ON t1 (a(20));
+--error ER_WRONG_SUB_KEY
+CREATE INDEX i2 ON t1 (a(20));
+# cleanup
+DROP TABLE t1;
+
diff --git a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test
index ed268ab5846..70a95e5f16e 100644
--- a/mysql-test/t/constraints.test
+++ b/mysql-test/t/constraints.test
@@ -10,7 +10,7 @@ create table t1 (a int check (a>0));
insert into t1 values (1);
insert into t1 values (0);
drop table t1;
-create table t1 (a int ,b int, check a>b);
+create table t1 (a int, b int, check (a>b));
insert into t1 values (1,0);
insert into t1 values (0,1);
drop table t1;
@@ -29,3 +29,45 @@ show create table t1;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug#35578 (Parser allows useless/illegal CREATE TABLE syntax)
+#
+
+--disable_warnings
+drop table if exists t_illegal;
+--enable_warnings
+
+--error ER_PARSE_ERROR
+create table t_illegal (a int, b int, check a>b);
+
+--error ER_PARSE_ERROR
+create table t_illegal (a int, b int, constraint abc check a>b);
+
+--error ER_PARSE_ERROR
+create table t_illegal (a int, b int, constraint abc);
+
+#
+# Bug#11714 (Non-sensical ALTER TABLE ADD CONSTRAINT allowed)
+#
+
+--disable_warnings
+drop table if exists t_11714;
+--enable_warnings
+
+create table t_11714(a int, b int);
+
+--error ER_PARSE_ERROR
+alter table t_11714 add constraint cons1;
+
+drop table t_11714;
+
+#
+# Bug#38696 (CREATE TABLE ... CHECK ... allows illegal syntax)
+
+--error ER_PARSE_ERROR
+CREATE TABLE t_illegal (col_1 INT CHECK something (whatever));
+
+--error ER_PARSE_ERROR
+CREATE TABLE t_illegal (col_1 INT CHECK something);
+
diff --git a/mysql-test/t/foreign_key.test b/mysql-test/t/foreign_key.test
index 0a3708e6dc8..2a6ab01f511 100644
--- a/mysql-test/t/foreign_key.test
+++ b/mysql-test/t/foreign_key.test
@@ -23,3 +23,75 @@ create unique index b on t1 (a,b);
drop table t1;
# End of 4.1 tests
+
+#
+# Bug#34455 (Ambiguous foreign keys syntax is accepted)
+#
+
+--disable_warnings
+drop table if exists t_34455;
+--enable_warnings
+
+# 2 match clauses, illegal
+--error ER_PARSE_ERROR
+create table t_34455 (
+ a int not null,
+ foreign key (a) references t3 (a) match full match partial);
+
+# match after on delete, illegal
+--error ER_PARSE_ERROR
+create table t_34455 (
+ a int not null,
+ foreign key (a) references t3 (a) on delete set default match full);
+
+# match after on update, illegal
+--error ER_PARSE_ERROR
+create table t_34455 (
+ a int not null,
+ foreign key (a) references t3 (a) on update set default match full);
+
+# 2 on delete clauses, illegal
+--error ER_PARSE_ERROR
+create table t_34455 (
+ a int not null,
+ foreign key (a) references t3 (a)
+ on delete set default on delete set default);
+
+# 2 on update clauses, illegal
+--error ER_PARSE_ERROR
+create table t_34455 (
+ a int not null,
+ foreign key (a) references t3 (a)
+ on update set default on update set default);
+
+create table t_34455 (a int not null);
+
+# 2 match clauses, illegal
+--error ER_PARSE_ERROR
+alter table t_34455
+ add foreign key (a) references t3 (a) match full match partial);
+
+# match after on delete, illegal
+--error ER_PARSE_ERROR
+alter table t_34455
+ add foreign key (a) references t3 (a) on delete set default match full);
+
+# match after on update, illegal
+--error ER_PARSE_ERROR
+alter table t_34455
+ add foreign key (a) references t3 (a) on update set default match full);
+
+# 2 on delete clauses, illegal
+--error ER_PARSE_ERROR
+alter table t_34455
+ add foreign key (a) references t3 (a)
+ on delete set default on delete set default);
+
+# 2 on update clauses, illegal
+--error ER_PARSE_ERROR
+alter table t_34455
+ add foreign key (a) references t3 (a)
+ on update set default on update set default);
+
+drop table t_34455;
+
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index 70d73234ea8..1aeb2fa5b14 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -726,3 +726,48 @@ SELECT Polygon(1234512,'');
SELECT Polygon(12345123,'');
--echo End of 5.1 tests
+
+#
+# Bug #50574 5.5.x allows spatial indexes on non-spatial
+# columns, causing crashes!
+#
+--error ER_SPATIAL_MUST_HAVE_GEOM_COL
+CREATE TABLE t1(
+ col0 BINARY NOT NULL,
+ col2 TIMESTAMP,
+ SPATIAL INDEX i1 (col0)
+) ENGINE=MyISAM;
+
+# Test other ways to add indices
+CREATE TABLE t1 (
+ col0 BINARY NOT NULL,
+ col2 TIMESTAMP
+) ENGINE=MyISAM;
+
+--error ER_SPATIAL_MUST_HAVE_GEOM_COL
+CREATE SPATIAL INDEX idx0 ON t1(col0);
+
+--error ER_SPATIAL_MUST_HAVE_GEOM_COL
+ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
+
+CREATE TABLE t2 (
+ col0 INTEGER NOT NULL,
+ col1 POINT,
+ col2 POINT
+);
+
+--error ER_WRONG_ARGUMENTS
+CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
+
+--error ER_WRONG_ARGUMENTS
+CREATE TABLE t3 (
+ col0 INTEGER NOT NULL,
+ col1 POINT,
+ col2 LINESTRING,
+ SPATIAL INDEX i1 (col1, col2)
+);
+
+# cleanup
+DROP TABLE t1;
+DROP TABLE t2;
+
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index 0e6fef9b855..1e7f28d5916 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -1166,3 +1166,22 @@ SELECT (SUM(DISTINCT a) + MAX(b)) FROM t2 GROUP BY a;
DROP TABLE t1,t2;
--echo # end of WL#3220 tests
+
+--echo #
+--echo # Bug#50539: Wrong result when loose index scan is used for an aggregate
+--echo # function with distinct
+--echo #
+CREATE TABLE t1 (
+ f1 int(11) NOT NULL DEFAULT '0',
+ f2 char(1) NOT NULL DEFAULT '',
+ PRIMARY KEY (f1,f2)
+) ;
+insert into t1 values(1,'A'),(1 , 'B'), (1, 'C'), (2, 'A'),
+(3, 'A'), (3, 'B'), (3, 'C'), (3, 'D');
+
+SELECT f1, COUNT(DISTINCT f2) FROM t1 GROUP BY f1;
+explain SELECT f1, COUNT(DISTINCT f2) FROM t1 GROUP BY f1;
+
+drop table t1;
+--echo # End of test#50539.
+
diff --git a/mysql-test/t/ipv4_as_ipv6.test b/mysql-test/t/ipv4_as_ipv6.test
index 4f4e68e8bfc..ace3c286643 100644
--- a/mysql-test/t/ipv4_as_ipv6.test
+++ b/mysql-test/t/ipv4_as_ipv6.test
@@ -5,8 +5,7 @@
# Test of ipv4 (127.0.0.1) in ipv6 format
# Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding opt file).
#
-# Can't be tested with windows due to mixed format like 0::0000:FFFF:127.0.0.1
---source include/not_windows.inc
+--source include/have_ipv4_mapped.inc
# Can't be tested with embedded server
--source include/not_embedded.inc
diff --git a/mysql-test/t/ipv4_as_ipv6_win-master.opt b/mysql-test/t/ipv4_as_ipv6_win-master.opt
deleted file mode 100644
index f55a8e9209d..00000000000
--- a/mysql-test/t/ipv4_as_ipv6_win-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-name-resolve --bind-address=0.0.0.0
diff --git a/mysql-test/t/ipv4_as_ipv6_win.test b/mysql-test/t/ipv4_as_ipv6_win.test
deleted file mode 100644
index 04f908a119d..00000000000
--- a/mysql-test/t/ipv4_as_ipv6_win.test
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2009 SUN Microsystems
-# All rights reserved. Use is subject to license terms.
-# Author: Horst Hunger
-# Nov. 19, 2009
-# Test of ipv4 (127.0.0.1) in ipv6 format
-# Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding opt file).
-#
-# For windows due to missing the mixed format like 0::0000:FFFF:127.0.0.1
---source include/windows.inc
-# Can't be tested with embedded server
---source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-echo =============Test of '127.0.0.1' (IPv4) ===========================;
-let $IPv6= 127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '::1' ========================;
-let $IPv6= ::1;
---echo connect (con1, $IPv6, root, , test, MASTER_MYPORT);
---disable_query_log
---error 2003,2006
-connect (con1, $IPv6, root, , test, $MASTER_MYPORT);
---enable_query_log
-connection default;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/ipv6.test b/mysql-test/t/ipv6.test
index a1515e9d533..5c08cde3746 100644
--- a/mysql-test/t/ipv6.test
+++ b/mysql-test/t/ipv6.test
@@ -6,9 +6,6 @@
# Options: --skip-name-resolve, --bind-address=:: (see corresponding opt file).
#
--source include/check_ipv6.inc
-
-# Can't be tested with windows due to the mixed format like 0:0:0:0:0:FFFF:127.0.0.1
---source include/not_windows.inc
# Can't be tested with embedded server
--source include/not_embedded.inc
@@ -35,45 +32,5 @@ let $IPv6= 0:0:0:0:0:0:0:1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
-echo =============Test of '127.0.0.1' (IPv4) ===========================;
-let $IPv6= 127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '0:0:0:0:0:FFFF:127.0.0.1' ===================;
-let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '0000:0000:0000:0000:0000:FFFF:127.0.0.1' ====;
-let $IPv6= 0000:0000:0000:0000:0000:FFFF:127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '0:0000:0000:0:0000:FFFF:127.0.0.1' ====;
-let $IPv6= 0:0000:0000:0:0000:FFFF:127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '0::0000:FFFF:127.0.0.1' ====;
-let $IPv6= 0::0000:FFFF:127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '0:0:0:0:0:FFFF:127.0.0.1/96' ================;
-let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1/96;
-#--source include/ipv6_clients.inc
-#--source include/ipv6.inc
-
-echo =============Test of '::FFFF:127.0.0.1' ===========================;
-let $IPv6= ::FFFF:127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '::FFFF:127.0.0.1/96' ========================;
-let $IPv6= ::FFFF:127.0.0.1/96;
-#--source include/ipv6_clients.inc
-#--source include/ipv6.inc
-
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/ipv6_win-master.opt b/mysql-test/t/ipv6_win-master.opt
deleted file mode 100644
index d705811808c..00000000000
--- a/mysql-test/t/ipv6_win-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-name-resolve --bind-address=::
diff --git a/mysql-test/t/ipv6_win.test b/mysql-test/t/ipv6_win.test
deleted file mode 100644
index 86d867cc448..00000000000
--- a/mysql-test/t/ipv6_win.test
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright (C) 2009 SUN Microsystems
-# All rights reserved. Use is subject to license terms.
-# Author: Horst Hunger
-# Nov. 19, 2009
-# Test of ipv6 format
-# Options: --skip-name-resolve, --bind-address=:: (see corresponding opt file).
-#
---source include/check_ipv6.inc
-
-# For windows due to missing the mixed format like 0::0000:FFFF:127.0.0.1
---source include/windows.inc
-# Can't be tested with embedded server
---source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-echo =============Test of '::1' ========================================;
-let $IPv6= ::1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '::1/128' ====================================;
-let $IPv6= ::1/128;
-#--source include/ipv6_clients.inc
-#--source include/ipv6.inc
-
-echo =============Test of '0000:0000:0000:0000:0000:0000:0000:0001' ====;
-let $IPv6= 0000:0000:0000:0000:0000:0000:0000:0001;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '0:0:0:0:0:0:0:1' ============================;
-let $IPv6= 0:0:0:0:0:0:0:1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/show_profile.test b/mysql-test/t/show_profile.test
new file mode 100644
index 00000000000..c20b29c40bf
--- /dev/null
+++ b/mysql-test/t/show_profile.test
@@ -0,0 +1,18 @@
+#
+# Test for show profiles
+# No meaningful check is possible.
+# So it only checks that SET profiling is possible and
+# that SHOW PROFILES, SHOW PROFILE FOR QUERY and SHOW PROFILE CPU FOR QUERY
+# do not cause syntax errors. It also increases code coverage for sql_profile.cc
+
+--source include/have_profiling.inc
+SET profiling = 1;
+SELECT 1;
+--replace_column 2 #
+SHOW PROFILES;
+--disable_result_log
+SHOW PROFILE FOR QUERY 1;
+SHOW PROFILE CPU FOR QUERY 1;
+--enable_result_log
+SET profiling = 0;
+