summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2012-03-14 13:58:18 +0200
committerunknown <sanja@montyprogram.com>2012-03-14 13:58:18 +0200
commit5338a28912589f1169b66b880a489ec5636bcd83 (patch)
treed0e1156d56a95d2051d499b065d78395bc302528 /mysql-test
parent0f3b8ef28ed19145e0cd850ef522ddf7cf662592 (diff)
parente638e605895fb572047ec8027e91c5438d77cbf4 (diff)
downloadmariadb-git-5338a28912589f1169b66b880a489ec5636bcd83.tar.gz
Merge 5.2->5.3
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_group.result47
-rw-r--r--mysql-test/r/group_by.result19
-rw-r--r--mysql-test/suite/maria/r/maria-ucs2.result39
-rw-r--r--mysql-test/suite/maria/r/maria3.result31
-rw-r--r--mysql-test/suite/maria/t/maria-ucs2.test51
-rw-r--r--mysql-test/suite/maria/t/maria3.test23
-rw-r--r--mysql-test/suite/vcol/r/vcol_misc.result13
-rw-r--r--mysql-test/suite/vcol/t/vcol_misc.test14
-rw-r--r--mysql-test/t/func_group.test33
-rw-r--r--mysql-test/t/group_by.test20
10 files changed, 243 insertions, 47 deletions
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index f1d3777e097..9c15af41799 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1887,6 +1887,53 @@ NULL
NULL
DROP TABLE t1,t2,t3;
#
+# Bug #884175: MIN/MAX for short varchar = long const
+#
+CREATE TABLE t1 (f1 varchar(1), f2 varchar(1), KEY (f2));
+INSERT INTO t1 VALUES ('b', 'b'), ('a','a');
+EXPLAIN
+SELECT MAX(f1) FROM t1 WHERE f1 = 'abc';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+SELECT MAX(f1) FROM t1 WHERE f1 = 'abc';
+MAX(f1)
+NULL
+EXPLAIN
+SELECT MAX(f2) FROM t1 WHERE f2 = 'abc';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref f2 f2 4 const 1 Using where; Using index
+SELECT MAX(f2) FROM t1 WHERE f2 = 'abc';
+MAX(f2)
+NULL
+EXPLAIN
+SELECT MIN(f1) FROM t1 WHERE f1 >= 'abc';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+SELECT MIN(f1) FROM t1 WHERE f1 >= 'abc';
+MIN(f1)
+b
+EXPLAIN
+SELECT MIN(f2) FROM t1 WHERE f2 >= 'abc';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index f2 f2 4 NULL 2 Using where; Using index
+SELECT MIN(f2) FROM t1 WHERE f2 >= 'abc';
+MIN(f2)
+b
+EXPLAIN
+SELECT MIN(f1) FROM t1 WHERE f1 BETWEEN 'abc' AND 'b' ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+SELECT MIN(f1) FROM t1 WHERE f1 BETWEEN 'abc' AND 'b' ;
+MIN(f1)
+b
+EXPLAIN
+SELECT MIN(f2) FROM t1 WHERE f2 BETWEEN 'abc' AND 'b' ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index f2 f2 4 NULL 2 Using where; Using index
+SELECT MIN(f2) FROM t1 WHERE f2 BETWEEN 'abc' AND 'b' ;
+MIN(f2)
+b
+DROP TABLE t1;
End of 5.2 tests
#
# BUG#46680 - Assertion failed in file item_subselect.cc,
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 6ac3257ca6c..7405095c965 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1952,6 +1952,24 @@ DROP TABLE t1;
SET SQL_BIG_TABLES=0;
# End of 5.1 tests
#
+# LP bug#694450 Wrong result with non-standard GROUP BY + ORDER BY
+#
+SET SESSION SQL_MODE='ONLY_FULL_GROUP_BY';
+CREATE TABLE t1 (
+f1 int(11), f2 int(11), f3 datetime, f4 varchar(1), PRIMARY KEY (f1)) ;
+INSERT IGNORE INTO t1 VALUES ('1','9','2004-10-11 18:13','x'),('2','5','2004-03-07 14:02','g'),('3','1','2004-04-09 09:38','o'),('4','0','1900-01-01 00:00','g'),('5','1','2009-02-19 02:05','v');
+SELECT alias2.f3 AS field1 , alias2.f1 AS field2 FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f1 = alias1.f2 AND alias2.f1 != alias1.f4 GROUP BY field1 , field2 ORDER BY alias1.f2 , field2;
+field1 field2
+2004-10-11 18:13:00 1
+2009-02-19 02:05:00 5
+SELECT alias2.f3 AS field1 , alias2.f1 AS field2 FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f1 = alias1.f2 AND alias2.f1 != alias1.f4 GROUP BY field1 , field2 ;
+field1 field2
+2004-10-11 18:13:00 1
+2009-02-19 02:05:00 5
+SET SESSION SQL_MODE=default;
+drop table t1;
+# End of 5.2 tests
+#
# BUG#872702: Crash in add_ref_to_table_cond() when grouping by a PK
#
CREATE TABLE t1 (a int, PRIMARY KEY (a)) ;
@@ -1966,3 +1984,4 @@ FROM t2
GROUP BY 1;
a
DROP TABLE t1, t2;
+# End of 5.3 tests
diff --git a/mysql-test/suite/maria/r/maria-ucs2.result b/mysql-test/suite/maria/r/maria-ucs2.result
new file mode 100644
index 00000000000..e7258f21d4f
--- /dev/null
+++ b/mysql-test/suite/maria/r/maria-ucs2.result
@@ -0,0 +1,39 @@
+select * from INFORMATION_SCHEMA.ENGINES where ENGINE="ARIA";
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+Aria YES Crash-safe tables with MyISAM heritage NO NO NO
+set global storage_engine=aria;
+set session storage_engine=aria;
+drop table if exists t1;
+SET SQL_WARNINGS=1;
+CREATE TABLE t1 ( a VARCHAR(800),KEY(a) )
+ENGINE=Aria DEFAULT CHARACTER SET latin1;
+INSERT INTO t1 VALUES
+(REPEAT('abc ',200)), (REPEAT('def ',200)),
+(REPEAT('ghi ',200)), (REPEAT('jkl ',200));
+INSERT INTO t1 SELECT * FROM t1;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+ALTER TABLE t1 MODIFY a VARCHAR(800) CHARSET `ucs2`;
+Warnings:
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SHOW CREATE table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(800) CHARACTER SET ucs2 DEFAULT NULL,
+ KEY `a` (`a`(500))
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(800),KEY(a)) ENGINE=Aria CHARACTER SET ucs2;
+Warnings:
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+INSERT INTO t1 VALUES (REPEAT('abc ',200));
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+# End of 5.2 tests
diff --git a/mysql-test/suite/maria/r/maria3.result b/mysql-test/suite/maria/r/maria3.result
index 8c27e0e9dcd..8018ca03a8e 100644
--- a/mysql-test/suite/maria/r/maria3.result
+++ b/mysql-test/suite/maria/r/maria3.result
@@ -393,6 +393,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+set global aria_page_checksum=0;
drop table t1;
set global aria_log_file_size=4294967296;
Warnings:
@@ -509,7 +510,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`n` int(11) NOT NULL,
`c` char(1) DEFAULT NULL
-) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0
drop table t1;
create table t1 (n int not null, c char(1)) engine=aria transactional=1;
alter table t1 engine=myisam;
@@ -521,7 +522,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`n` int(11) NOT NULL,
`c` char(1) DEFAULT NULL
-) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 TRANSACTIONAL=1
drop table t1;
create table t1 (n int not null, c char(1)) engine=myisam transactional=1;
Warnings:
@@ -532,7 +533,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`n` int(11) NOT NULL,
`c` char(1) DEFAULT NULL
-) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 TRANSACTIONAL=1
drop table t1;
create table t1 (a int, key(a)) transactional=0;
insert into t1 values (0),(1),(2),(3),(4);
@@ -645,26 +646,4 @@ a b c d e f g h i j
1 A B C D 1 M H
2 Abcdefghi E F G 2 N H
drop table t1,t2;
-CREATE TABLE t1 ( a VARCHAR(800),KEY(a) )
-ENGINE=Aria DEFAULT CHARACTER SET latin1;
-INSERT INTO t1 VALUES
-(REPEAT('abc ',200)), (REPEAT('def ',200)),
-(REPEAT('ghi ',200)), (REPEAT('jkl ',200));
-INSERT INTO t1 SELECT * FROM t1;
-CHECK TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-ALTER TABLE t1 MODIFY a VARCHAR(800) CHARSET `ucs2`;
-Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
-Warning 1071 Specified key was too long; max key length is 1000 bytes
-CHECK TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-SHOW CREATE table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` varchar(800) CHARACTER SET ucs2 DEFAULT NULL,
- KEY `a` (`a`(500))
-) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
-DROP TABLE t1;
+# End of 5.1 tests
diff --git a/mysql-test/suite/maria/t/maria-ucs2.test b/mysql-test/suite/maria/t/maria-ucs2.test
new file mode 100644
index 00000000000..fed67d780e9
--- /dev/null
+++ b/mysql-test/suite/maria/t/maria-ucs2.test
@@ -0,0 +1,51 @@
+-- source include/have_maria.inc
+-- source include/have_ucs2.inc
+
+select * from INFORMATION_SCHEMA.ENGINES where ENGINE="ARIA";
+
+let $default_engine=`select @@global.storage_engine`;
+set global storage_engine=aria;
+set session storage_engine=aria;
+
+# Initialise
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+SET SQL_WARNINGS=1;
+
+#
+# bug#905716: Assertion `page->size <= share->max_index_block_size'
+#
+
+CREATE TABLE t1 ( a VARCHAR(800),KEY(a) )
+ ENGINE=Aria DEFAULT CHARACTER SET latin1;
+INSERT INTO t1 VALUES
+ (REPEAT('abc ',200)), (REPEAT('def ',200)),
+ (REPEAT('ghi ',200)), (REPEAT('jkl ',200));
+INSERT INTO t1 SELECT * FROM t1;
+# check table is not needed to reproduce the problem,
+# but shows that by this time the table appears to be okay.
+CHECK TABLE t1;
+ALTER TABLE t1 MODIFY a VARCHAR(800) CHARSET `ucs2`;
+CHECK TABLE t1;
+SHOW CREATE table t1;
+DROP TABLE t1;
+
+#
+# BUG#905782 Assertion `pageno < ((1ULL) << 40)' failed at ma_pagecache.c
+# Issue was too long key
+#
+
+CREATE TABLE t1 (a VARCHAR(800),KEY(a)) ENGINE=Aria CHARACTER SET ucs2;
+INSERT INTO t1 VALUES (REPEAT('abc ',200));
+CHECK TABLE t1;
+DROP TABLE t1;
+
+--echo # End of 5.2 tests
+
+
+--disable_result_log
+--disable_query_log
+eval set global storage_engine=$default_engine;
+--enable_result_log
+--enable_query_log
diff --git a/mysql-test/suite/maria/t/maria3.test b/mysql-test/suite/maria/t/maria3.test
index a2305f40807..f93706cf469 100644
--- a/mysql-test/suite/maria/t/maria3.test
+++ b/mysql-test/suite/maria/t/maria3.test
@@ -305,6 +305,7 @@ drop table t1;
set global aria_page_checksum=1;
create table t1 (a int);
show create table t1;
+set global aria_page_checksum=0;
drop table t1;
#
@@ -554,27 +555,7 @@ INSERT INTO t2 VALUES (1,'M','','H'),
SELECT * FROM t1, t2 WHERE a = g ORDER BY b;
drop table t1,t2;
-# End of 5.1 tests
-
-#
-# bug#905716: Assertion `page->size <= share->max_index_block_size'
-#
-
-CREATE TABLE t1 ( a VARCHAR(800),KEY(a) )
- ENGINE=Aria DEFAULT CHARACTER SET latin1;
-INSERT INTO t1 VALUES
- (REPEAT('abc ',200)), (REPEAT('def ',200)),
- (REPEAT('ghi ',200)), (REPEAT('jkl ',200));
-INSERT INTO t1 SELECT * FROM t1;
-# check table is not needed to reproduce the problem,
-# but shows that by this time the table appears to be okay.
-CHECK TABLE t1;
-ALTER TABLE t1 MODIFY a VARCHAR(800) CHARSET `ucs2`;
-CHECK TABLE t1;
-SHOW CREATE table t1;
-DROP TABLE t1;
-
-# End of 5.2 tests
+--echo # End of 5.1 tests
--disable_result_log
--disable_query_log
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result
index 693ea0d9174..c27b36089c6 100644
--- a/mysql-test/suite/vcol/r/vcol_misc.result
+++ b/mysql-test/suite/vcol/r/vcol_misc.result
@@ -133,6 +133,19 @@ t1 CREATE TABLE `t1` (
`v` char(32) CHARACTER SET ucs2 AS (a) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (a int, b int as (a+1) VIRTUAL);
+SELECT table_schema, table_name, column_name, column_type, extra
+FROM information_schema.columns WHERE table_name = 't1';
+table_schema table_name column_name column_type extra
+test t1 a int(11)
+test t1 b int(11)
+SELECT table_schema, table_name, column_name, column_type, extra
+FROM information_schema.columns WHERE table_name = 't2';
+table_schema table_name column_name column_type extra
+test t2 a int(11)
+test t2 b int(11) VIRTUAL
+DROP TABLE t1,t2;
create table t1 (a int, b int);
insert into t1 values (3, 30), (4, 20), (1, 20);
create table t2 (c int, d int, v int as (d+1), index idx(c));
diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test
index f87cb5fbec8..6f576f61513 100644
--- a/mysql-test/suite/vcol/t/vcol_misc.test
+++ b/mysql-test/suite/vcol/t/vcol_misc.test
@@ -142,6 +142,20 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
#
+# Bug#930814: no info in information schema for tables with virtual columns
+#
+
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (a int, b int as (a+1) VIRTUAL);
+
+SELECT table_schema, table_name, column_name, column_type, extra
+ FROM information_schema.columns WHERE table_name = 't1';
+SELECT table_schema, table_name, column_name, column_type, extra
+ FROM information_schema.columns WHERE table_name = 't2';
+
+DROP TABLE t1,t2;
+
+#
# SELECT that uses a virtual column and executed with BKA
#
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index f6091883168..3e31c61ac37 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1198,6 +1198,39 @@ SELECT (SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b) FROM t3;
DROP TABLE t1,t2,t3;
--echo #
+--echo # Bug #884175: MIN/MAX for short varchar = long const
+--echo #
+
+CREATE TABLE t1 (f1 varchar(1), f2 varchar(1), KEY (f2));
+INSERT INTO t1 VALUES ('b', 'b'), ('a','a');
+
+EXPLAIN
+SELECT MAX(f1) FROM t1 WHERE f1 = 'abc';
+SELECT MAX(f1) FROM t1 WHERE f1 = 'abc';
+
+EXPLAIN
+SELECT MAX(f2) FROM t1 WHERE f2 = 'abc';
+SELECT MAX(f2) FROM t1 WHERE f2 = 'abc';
+
+EXPLAIN
+SELECT MIN(f1) FROM t1 WHERE f1 >= 'abc';
+SELECT MIN(f1) FROM t1 WHERE f1 >= 'abc';
+
+EXPLAIN
+SELECT MIN(f2) FROM t1 WHERE f2 >= 'abc';
+SELECT MIN(f2) FROM t1 WHERE f2 >= 'abc';
+
+EXPLAIN
+SELECT MIN(f1) FROM t1 WHERE f1 BETWEEN 'abc' AND 'b' ;
+SELECT MIN(f1) FROM t1 WHERE f1 BETWEEN 'abc' AND 'b' ;
+
+EXPLAIN
+SELECT MIN(f2) FROM t1 WHERE f2 BETWEEN 'abc' AND 'b' ;
+SELECT MIN(f2) FROM t1 WHERE f2 BETWEEN 'abc' AND 'b' ;
+
+DROP TABLE t1;
+
+
--echo End of 5.2 tests
--echo #
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 5d7421904d2..2fd0668b34d 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1327,6 +1327,24 @@ SET SQL_BIG_TABLES=0;
--echo # End of 5.1 tests
--echo #
+--echo # LP bug#694450 Wrong result with non-standard GROUP BY + ORDER BY
+--echo #
+SET SESSION SQL_MODE='ONLY_FULL_GROUP_BY';
+CREATE TABLE t1 (
+f1 int(11), f2 int(11), f3 datetime, f4 varchar(1), PRIMARY KEY (f1)) ;
+INSERT IGNORE INTO t1 VALUES ('1','9','2004-10-11 18:13','x'),('2','5','2004-03-07 14:02','g'),('3','1','2004-04-09 09:38','o'),('4','0','1900-01-01 00:00','g'),('5','1','2009-02-19 02:05','v');
+
+# This must return an error, but instead returns 1 row
+SELECT alias2.f3 AS field1 , alias2.f1 AS field2 FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f1 = alias1.f2 AND alias2.f1 != alias1.f4 GROUP BY field1 , field2 ORDER BY alias1.f2 , field2;
+
+# This returns several rows
+SELECT alias2.f3 AS field1 , alias2.f1 AS field2 FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f1 = alias1.f2 AND alias2.f1 != alias1.f4 GROUP BY field1 , field2 ;
+SET SESSION SQL_MODE=default;
+drop table t1;
+
+--echo # End of 5.2 tests
+
+--echo #
--echo # BUG#872702: Crash in add_ref_to_table_cond() when grouping by a PK
--echo #
CREATE TABLE t1 (a int, PRIMARY KEY (a)) ;
@@ -1343,3 +1361,5 @@ WHERE a = (
GROUP BY 1;
DROP TABLE t1, t2;
+--echo # End of 5.3 tests
+