summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2012-06-18 22:38:11 +0400
committerSergey Petrunya <psergey@askmonty.org>2012-06-18 22:38:11 +0400
commit90fbd8b22b4b84cdc027fed26012efd87c2b6737 (patch)
tree48eff1dbe5fd3468e7583d1748de6b5cc8b16c92 /mysql-test/t
parentdb6dbadb5a9edd9e93398b6afe8e3196eb768e0a (diff)
parent64aa1fcb1354ffa24999a1512258c897116b0928 (diff)
downloadmariadb-git-90fbd8b22b4b84cdc027fed26012efd87c2b6737.tar.gz
Merge 5.2->5.3
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/func_in.test12
-rw-r--r--mysql-test/t/func_test.test20
-rw-r--r--mysql-test/t/mysqltest_256.test17
-rw-r--r--mysql-test/t/ps.test75
-rw-r--r--mysql-test/t/user_var.test11
5 files changed, 130 insertions, 5 deletions
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index ece19882acc..fea3a2ed6d3 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -577,6 +577,16 @@ DROP TABLE t1;
--echo #
--echo End of 5.1 tests
+--echo #
+--echo # LP bug#992380 Crash when creating PS for a query with
+--echo # subquery in WHERE (see also mysql bug#13012483)
+--echo #
+CREATE TABLE t1 (a INT);
+PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
+EXECUTE s;
+
+DROP TABLE t1;
+
#
# lp:817966 int_column IN (string_constant)
#
@@ -595,4 +605,4 @@ select * from t1 where a='2.1';
select * from t1 where b='2.1';
select * from t1 where IF(1,a,a)='2.1';
drop table t1;
-
+--echo # End of 5.3 tests
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index 77bf3be5e72..4cba29986a1 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -160,3 +160,23 @@ SELECT LEAST(1.1,1.2,NULL,1.0) FROM DUAL;
SELECT GREATEST(1.5E+2,1.3E+2,NULL) FROM DUAL;
# End of 4.1 tests
+
+#
+# test of replacing NOT <field>
+#
+create table t1 (a int);
+insert into t1 values (1), (100), (0), (NULL);
+
+select not a from t1;
+explain extended select not a from t1;
+
+select * from t1 where not a;
+explain extended select * from t1 where not a;
+
+select not (a+0) from t1;
+explain extended select not (a+0) from t1;
+
+select * from t1 where not (a+0);
+explain extended select * from t1 where not (a+0);
+
+drop table t1;
diff --git a/mysql-test/t/mysqltest_256.test b/mysql-test/t/mysqltest_256.test
new file mode 100644
index 00000000000..fd9447cd2d8
--- /dev/null
+++ b/mysql-test/t/mysqltest_256.test
@@ -0,0 +1,17 @@
+#
+# MDEV-256 lp:995501 - mysqltest attempts to parse Perl code inside a block
+# with false condition, gets confused and throws wrong errors
+#
+
+let $run = 0;
+if ($run)
+{
+ --perl
+ foreach (1)
+ {
+ print "In perl\n";
+ }
+ EOF
+ SELECT 1;
+}
+--echo # Done
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 2f101b4e42f..89b9f4642e9 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -276,11 +276,11 @@ deallocate prepare Stmt1;
# also check that statement names are in right charset.
set names utf8;
-prepare `ü` from 'select 1234';
-execute `ü` ;
+prepare `ü` from 'select 1234';
+execute `ü` ;
set names latin1;
-execute `ü`;
-deallocate prepare `ü`;
+execute `ü`;
+deallocate prepare `ü`;
set names default;
@@ -3117,6 +3117,71 @@ DROP TABLE t1;
--echo End of 5.1 tests.
+--echo #
+--echo # LP bug#1001500 Crash on the second execution of the PS for
+--echo # a query with degenerated conjunctive condition
+--echo # (see also mysql bug#12582849)
+--echo #
+
+CREATE TABLE t1 (
+ pk INTEGER AUTO_INCREMENT,
+ col_int_nokey INTEGER,
+ col_int_key INTEGER,
+
+ col_varchar_key VARCHAR(1),
+ col_varchar_nokey VARCHAR(1),
+
+ PRIMARY KEY (pk),
+ KEY (col_int_key),
+ KEY (col_varchar_key, col_int_key)
+);
+
+INSERT INTO t1 (
+ col_int_key, col_int_nokey,
+ col_varchar_key, col_varchar_nokey
+) VALUES
+(4, 2, 'v', 'v'),
+(62, 150, 'v', 'v');
+
+CREATE TABLE t2 (
+ pk INTEGER AUTO_INCREMENT,
+ col_int_nokey INTEGER,
+ col_int_key INTEGER,
+
+ col_varchar_key VARCHAR(1),
+ col_varchar_nokey VARCHAR(1),
+
+ PRIMARY KEY (pk),
+ KEY (col_int_key),
+ KEY (col_varchar_key, col_int_key)
+);
+
+INSERT INTO t2 (
+ col_int_key, col_int_nokey,
+ col_varchar_key, col_varchar_nokey
+) VALUES
+(8, NULL, 'x', 'x'),
+(7, 8, 'd', 'd');
+
+PREPARE stmt FROM '
+SELECT
+ ( SELECT MAX( SQ1_alias2 .col_int_nokey ) AS SQ1_field1
+ FROM ( t2 AS SQ1_alias1 RIGHT JOIN t1 AS SQ1_alias2
+ ON ( SQ1_alias2.col_varchar_key = SQ1_alias1.col_varchar_nokey )
+ )
+ WHERE SQ1_alias2.pk < alias1.col_int_nokey OR alias1.pk
+ ) AS field1
+FROM ( t1 AS alias1 JOIN t2 AS alias2 ON alias2.pk )
+GROUP BY field1
+';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+DROP TABLE t1, t2;
+
#
# restoring of the Item tree in BETWEEN with dates
#
@@ -3243,3 +3308,5 @@ GROUP BY c1, c2;
EXECUTE s1;
DEALLOCATE PREPARE s1;
+
+--echo # End of 5.3 tests
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index efaf8afd91e..2782f61994d 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -365,4 +365,15 @@ SELECT (@v:=a) <> (@v:=1) FROM t1;
DROP TABLE t1;
+#
+# LP BUG#1001506 Crash on a query with GROUP BY and user variables
+# MySQL Bug #11764372 57197: EVEN MORE USER VARIABLE CRASHING FUN
+#
+
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1), (2);
+SELECT DISTINCT @a:=MIN(t1.a) FROM t1, t1 AS t2
+GROUP BY @b:=(SELECT COUNT(*) > t2.a);
+DROP TABLE t1;
+
--echo End of 5.1 tests