summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/ctype_ucs.result14
-rw-r--r--mysql-test/r/fulltext.result7
-rw-r--r--mysql-test/r/information_schema.result6
-rw-r--r--mysql-test/r/ndb_autodiscover.result2
-rw-r--r--mysql-test/r/ndb_index_ordered.result83
-rw-r--r--mysql-test/r/preload.result28
-rw-r--r--mysql-test/r/sp.result10
-rw-r--r--mysql-test/r/union.result22
-rw-r--r--mysql-test/t/ctype_ucs.test21
-rw-r--r--mysql-test/t/fulltext.test8
-rw-r--r--mysql-test/t/information_schema.test11
-rw-r--r--mysql-test/t/ndb_index_ordered.test52
-rw-r--r--mysql-test/t/row.test2
-rw-r--r--mysql-test/t/sp.test24
-rw-r--r--mysql-test/t/union.test12
15 files changed, 288 insertions, 14 deletions
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index fe2d76c8ab3..7a2bdc83584 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -624,3 +624,17 @@ ucs2_bin 00610009
ucs2_bin 0061
ucs2_bin 00610020
drop table t1;
+SET NAMES latin1;
+SET collation_connection='ucs2_swedish_ci';
+CREATE TABLE t1 (Field1 int(10) default '0');
+INSERT INTO t1 VALUES ('-1');
+SELECT * FROM t1;
+Field1
+-1
+DROP TABLE t1;
+CREATE TABLE t1 (Field1 int(10) unsigned default '0');
+INSERT INTO t1 VALUES ('-1');
+Warnings:
+Warning 1264 Out of range value adjusted for column 'Field1' at row 1
+DROP TABLE t1;
+SET NAMES latin1;
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index f50cae79608..77325c4e88b 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -408,3 +408,10 @@ insert t1 values (1, "aaaa"), (2, "bbbb");
insert t2 values (10, "aaaa"), (2, "cccc");
replace t1 select * from t2;
drop table t1, t2;
+CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t));
+SET NAMES latin1;
+INSERT INTO t1 VALUES('Mit freundlichem Grüß aus Osnabrück');
+SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabrück"' IN BOOLEAN MODE);
+COUNT(*)
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 9bf21e9f061..87e6062d411 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -604,3 +604,9 @@ Variable_name Value
show global status like "Threads_running";
Variable_name Value
Threads_running 1
+create table t1(f1 int);
+create table t2(f2 int);
+create view v1 as select * from t1, t2;
+set @got_val= (select count(*) from information_schema.columns);
+drop view v1;
+drop table t1, t2;
diff --git a/mysql-test/r/ndb_autodiscover.result b/mysql-test/r/ndb_autodiscover.result
index ba21483a9b0..1316e33c9ba 100644
--- a/mysql-test/r/ndb_autodiscover.result
+++ b/mysql-test/r/ndb_autodiscover.result
@@ -167,6 +167,8 @@ show status like 'handler_discover%';
Variable_name Value
Handler_discover 0
drop table t4;
+Warnings:
+Error 1296 Got error 709 'No such table existed' from NDB
flush status;
create table t4(
id int not null primary key,
diff --git a/mysql-test/r/ndb_index_ordered.result b/mysql-test/r/ndb_index_ordered.result
index 9aa7559d660..212c843cc44 100644
--- a/mysql-test/r/ndb_index_ordered.result
+++ b/mysql-test/r/ndb_index_ordered.result
@@ -554,6 +554,89 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
count(*)-9
0
drop table t1;
+create table t1 (
+a int primary key,
+s decimal(12),
+t decimal(12, 5),
+u decimal(12) unsigned,
+v decimal(12, 5) unsigned,
+key (s),
+key (t),
+key (u),
+key (v)
+) engine=ndb;
+insert into t1 values
+( 0, -000000000007, -0000061.00003, 000000000061, 0000965.00042),
+( 1, -000000000007, -0000061.00042, 000000000061, 0000965.00003),
+( 2, -071006035767, 4210253.00024, 000000000001, 0000001.84488),
+( 3, 000000007115, 0000000.77607, 000077350625, 0000018.00013),
+( 4, -000000068391, -0346486.00000, 000000005071, 0005334.00002),
+( 5, -521579890459, -1936874.00001, 000000000154, 0000003.00018),
+( 6, -521579890459, -1936874.00018, 000000000154, 0000003.00001),
+( 7, 000000000333, 0000051.39140, 000000907958, 0788643.08374),
+( 8, 000042731229, 0000009.00000, 000000000009, 6428667.00000),
+( 9, -000008159769, 0000918.00004, 000096951421, 7607730.00008);
+select count(*)- 5 from t1 use index (s) where s < -000000000007;
+count(*)- 5
+0
+select count(*)- 7 from t1 use index (s) where s <= -000000000007;
+count(*)- 7
+0
+select count(*)- 2 from t1 use index (s) where s = -000000000007;
+count(*)- 2
+0
+select count(*)- 5 from t1 use index (s) where s >= -000000000007;
+count(*)- 5
+0
+select count(*)- 3 from t1 use index (s) where s > -000000000007;
+count(*)- 3
+0
+select count(*)- 4 from t1 use index (t) where t < -0000061.00003;
+count(*)- 4
+0
+select count(*)- 5 from t1 use index (t) where t <= -0000061.00003;
+count(*)- 5
+0
+select count(*)- 1 from t1 use index (t) where t = -0000061.00003;
+count(*)- 1
+0
+select count(*)- 6 from t1 use index (t) where t >= -0000061.00003;
+count(*)- 6
+0
+select count(*)- 5 from t1 use index (t) where t > -0000061.00003;
+count(*)- 5
+0
+select count(*)- 2 from t1 use index (u) where u < 000000000061;
+count(*)- 2
+0
+select count(*)- 4 from t1 use index (u) where u <= 000000000061;
+count(*)- 4
+0
+select count(*)- 2 from t1 use index (u) where u = 000000000061;
+count(*)- 2
+0
+select count(*)- 8 from t1 use index (u) where u >= 000000000061;
+count(*)- 8
+0
+select count(*)- 6 from t1 use index (u) where u > 000000000061;
+count(*)- 6
+0
+select count(*)- 5 from t1 use index (v) where v < 0000965.00042;
+count(*)- 5
+0
+select count(*)- 6 from t1 use index (v) where v <= 0000965.00042;
+count(*)- 6
+0
+select count(*)- 1 from t1 use index (v) where v = 0000965.00042;
+count(*)- 1
+0
+select count(*)- 5 from t1 use index (v) where v >= 0000965.00042;
+count(*)- 5
+0
+select count(*)- 4 from t1 use index (v) where v > 0000965.00042;
+count(*)- 4
+0
+drop table t1;
create table t1(a int primary key, b int not null, index(b));
insert into t1 values (1,1), (2,2);
set autocommit=0;
diff --git a/mysql-test/r/preload.result b/mysql-test/r/preload.result
index f0b99a8d6f1..7237a0da7e0 100644
--- a/mysql-test/r/preload.result
+++ b/mysql-test/r/preload.result
@@ -74,15 +74,15 @@ Table Op Msg_type Msg_text
test.t1 preload_keys status OK
show status like "key_read%";
Variable_name Value
-Key_read_requests 0
-Key_reads 0
+Key_read_requests 581
+Key_reads 581
select count(*) from t1 where b = 'test1';
count(*)
4181
show status like "key_read%";
Variable_name Value
-Key_read_requests 217
-Key_reads 45
+Key_read_requests 798
+Key_reads 581
flush tables;
flush status;
show status like "key_read%";
@@ -98,15 +98,15 @@ Table Op Msg_type Msg_text
test.t1 preload_keys status OK
show status like "key_read%";
Variable_name Value
-Key_read_requests 0
-Key_reads 0
+Key_read_requests 10
+Key_reads 10
select count(*) from t1 where b = 'test1';
count(*)
4181
show status like "key_read%";
Variable_name Value
-Key_read_requests 217
-Key_reads 45
+Key_read_requests 227
+Key_reads 52
flush tables;
flush status;
show status like "key_read%";
@@ -123,8 +123,8 @@ test.t1 preload_keys status OK
test.t2 preload_keys status OK
show status like "key_read%";
Variable_name Value
-Key_read_requests 0
-Key_reads 0
+Key_read_requests 587
+Key_reads 587
select count(*) from t1 where b = 'test1';
count(*)
4181
@@ -133,8 +133,8 @@ count(*)
2584
show status like "key_read%";
Variable_name Value
-Key_read_requests 351
-Key_reads 73
+Key_read_requests 938
+Key_reads 613
flush tables;
flush status;
show status like "key_read%";
@@ -147,8 +147,8 @@ test.t3 preload_keys error Table 'test.t3' doesn't exist
test.t2 preload_keys status OK
show status like "key_read%";
Variable_name Value
-Key_read_requests 0
-Key_reads 0
+Key_read_requests 355
+Key_reads 355
flush tables;
flush status;
show status like "key_read%";
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 0af6b821ce0..05803e57ba0 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -2059,6 +2059,16 @@ call bug6029()|
1136
drop procedure bug6029|
drop table t3|
+drop procedure if exists bug8540|
+create procedure bug8540()
+begin
+declare x int default 1;
+select x as y, x+0 as z;
+end|
+call bug8540()|
+y z
+1 1
+drop procedure bug8540|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
drop procedure if exists ifac|
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 5a60ef8abfb..663793e0b5e 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1173,3 +1173,25 @@ show columns from t4;
Field Type Null Key Default Extra
sdate date YES NULL
drop table t1, t2, t3, t4;
+create table t1 (a int not null, b char (10) not null);
+insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
+select * from ((select * from t1 limit 1)) a;
+a b
+1 a
+select * from ((select * from t1 limit 1) union (select * from t1 limit 1)) a;
+a b
+1 a
+select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union (select * from t1 limit 1)) a;
+a b
+1 a
+select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a;
+a b
+1 a
+2 b
+3 c
+select * from ((select * from t1) union (((select * from t1))) union (select * from t1)) a;
+a b
+1 a
+2 b
+3 c
+drop table t1;
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 4780f51ebaa..954c4a8d8ab 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -392,3 +392,24 @@ SET collation_connection='ucs2_general_ci';
SET NAMES latin1;
SET collation_connection='ucs2_bin';
-- source include/ctype_filesort.inc
+
+SET NAMES latin1;
+#
+# Bug#8235
+#
+# This bug also helped to find another problem that
+# INSERT of a UCS2 string containing a negative number
+# into a unsigned int column didn't produce warnings.
+# This test covers both problems.
+#
+SET collation_connection='ucs2_swedish_ci';
+CREATE TABLE t1 (Field1 int(10) default '0');
+# no warnings, negative numbers are allowed
+INSERT INTO t1 VALUES ('-1');
+SELECT * FROM t1;
+DROP TABLE t1;
+CREATE TABLE t1 (Field1 int(10) unsigned default '0');
+# this should generate a "Data truncated" warning
+INSERT INTO t1 VALUES ('-1');
+DROP TABLE t1;
+SET NAMES latin1;
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 62dcecaff68..50d01da080f 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -322,3 +322,11 @@ insert t2 values (10, "aaaa"), (2, "cccc");
replace t1 select * from t2;
drop table t1, t2;
+#
+# bug#8351
+#
+CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t));
+SET NAMES latin1;
+INSERT INTO t1 VALUES('Mit freundlichem Grüß aus Osnabrück');
+SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabrück"' IN BOOLEAN MODE);
+DROP TABLE t1;
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index c34dfc94576..baf817b7c84 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -352,3 +352,14 @@ show variables where variable_name like "skip_show_databas";
# Bug #7981:SHOW GLOBAL STATUS crashes server
#
show global status like "Threads_running";
+
+#
+# Bug #7915 crash,JOIN VIEW, subquery,
+# SELECT .. FROM INFORMATION_SCHEMA.COLUMNS
+#
+create table t1(f1 int);
+create table t2(f2 int);
+create view v1 as select * from t1, t2;
+set @got_val= (select count(*) from information_schema.columns);
+drop view v1;
+drop table t1, t2;
diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test
index bea21f65381..2ebf06b78a8 100644
--- a/mysql-test/t/ndb_index_ordered.test
+++ b/mysql-test/t/ndb_index_ordered.test
@@ -280,6 +280,58 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
drop table t1;
+# decimal (not the new 5.0 thing)
+
+create table t1 (
+ a int primary key,
+ s decimal(12),
+ t decimal(12, 5),
+ u decimal(12) unsigned,
+ v decimal(12, 5) unsigned,
+ key (s),
+ key (t),
+ key (u),
+ key (v)
+) engine=ndb;
+#
+insert into t1 values
+ ( 0, -000000000007, -0000061.00003, 000000000061, 0000965.00042),
+ ( 1, -000000000007, -0000061.00042, 000000000061, 0000965.00003),
+ ( 2, -071006035767, 4210253.00024, 000000000001, 0000001.84488),
+ ( 3, 000000007115, 0000000.77607, 000077350625, 0000018.00013),
+ ( 4, -000000068391, -0346486.00000, 000000005071, 0005334.00002),
+ ( 5, -521579890459, -1936874.00001, 000000000154, 0000003.00018),
+ ( 6, -521579890459, -1936874.00018, 000000000154, 0000003.00001),
+ ( 7, 000000000333, 0000051.39140, 000000907958, 0788643.08374),
+ ( 8, 000042731229, 0000009.00000, 000000000009, 6428667.00000),
+ ( 9, -000008159769, 0000918.00004, 000096951421, 7607730.00008);
+#
+select count(*)- 5 from t1 use index (s) where s < -000000000007;
+select count(*)- 7 from t1 use index (s) where s <= -000000000007;
+select count(*)- 2 from t1 use index (s) where s = -000000000007;
+select count(*)- 5 from t1 use index (s) where s >= -000000000007;
+select count(*)- 3 from t1 use index (s) where s > -000000000007;
+#
+select count(*)- 4 from t1 use index (t) where t < -0000061.00003;
+select count(*)- 5 from t1 use index (t) where t <= -0000061.00003;
+select count(*)- 1 from t1 use index (t) where t = -0000061.00003;
+select count(*)- 6 from t1 use index (t) where t >= -0000061.00003;
+select count(*)- 5 from t1 use index (t) where t > -0000061.00003;
+#
+select count(*)- 2 from t1 use index (u) where u < 000000000061;
+select count(*)- 4 from t1 use index (u) where u <= 000000000061;
+select count(*)- 2 from t1 use index (u) where u = 000000000061;
+select count(*)- 8 from t1 use index (u) where u >= 000000000061;
+select count(*)- 6 from t1 use index (u) where u > 000000000061;
+#
+select count(*)- 5 from t1 use index (v) where v < 0000965.00042;
+select count(*)- 6 from t1 use index (v) where v <= 0000965.00042;
+select count(*)- 1 from t1 use index (v) where v = 0000965.00042;
+select count(*)- 5 from t1 use index (v) where v >= 0000965.00042;
+select count(*)- 4 from t1 use index (v) where v > 0000965.00042;
+
+drop table t1;
+
# bug#7798
create table t1(a int primary key, b int not null, index(b));
insert into t1 values (1,1), (2,2);
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
index 62e8eb7991c..58b90c9a356 100644
--- a/mysql-test/t/row.test
+++ b/mysql-test/t/row.test
@@ -7,7 +7,9 @@ select (1,2,3) IN ((3,2,3), (1,2,3), (1,3,3));
select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3));
select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
+--disable_ps_warnings
select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
+--enable_ps_warnings
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index d474fb1c84e..8b59af6e494 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -2520,6 +2520,22 @@ call bug6029()|
drop procedure bug6029|
drop table t3|
+#
+# BUG#8540: Local variable overrides an alias
+#
+--disable_warnings
+drop procedure if exists bug8540|
+--enable_warnings
+
+create procedure bug8540()
+begin
+ declare x int default 1;
+ select x as y, x+0 as z;
+end|
+
+call bug8540()|
+drop procedure bug8540|
+
#
# Some "real" examples
@@ -2811,6 +2827,12 @@ drop function getcount|
#
# BUG#5240: Stored procedure crash if function has cursor declaration
#
+# The following test case fails in --ps-protocol mode due to some bugs
+# in algorithm which calculates list of tables to be locked for queries
+# using Stored Functions. It is disabled until Dmitri fixes this.
+#
+--disable_ps_protocol
+
--disable_warnings
drop function if exists bug5240|
--enable_warnings
@@ -2831,6 +2853,8 @@ insert into t1 values ("answer", 42)|
select id, bug5240() from t1|
drop function bug5240|
+--enable_ps_protocol
+
#
# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
#
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index be6bc7a48d8..5ff22f1d6b6 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -717,3 +717,15 @@ union
order by sdate;
show columns from t4;
drop table t1, t2, t3, t4;
+
+#
+# Bug #2435 UNION with parentheses not supported
+#
+create table t1 (a int not null, b char (10) not null);
+insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
+select * from ((select * from t1 limit 1)) a;
+select * from ((select * from t1 limit 1) union (select * from t1 limit 1)) a;
+select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union (select * from t1 limit 1)) a;
+select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a;
+select * from ((select * from t1) union (((select * from t1))) union (select * from t1)) a;
+drop table t1;