1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Merge revisions from maria/5.5

bzr merge -r4388 lp:maria/5.5
This commit is contained in:
Nirbhay Choubey
2014-12-16 20:07:34 -05:00
241 changed files with 307083 additions and 3358 deletions

View File

@@ -330,7 +330,7 @@ sub testcase_timeout ($) {
return $opt_testcase_timeout * 60;
}
sub check_timeout ($) { return testcase_timeout($_[0]) / 10; }
sub check_timeout ($) { return testcase_timeout($_[0]); }
our $opt_warnings= 1;
@@ -4842,6 +4842,8 @@ sub extract_warning_lines ($$) {
qr|feedback plugin: failed to retrieve the MAC address|,
qr|Plugin 'FEEDBACK' init function returned error|,
qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|,
qr|Failed to setup SSL|,
qr|SSL error: Failed to set ciphers to use|,
# Galera-related warnings.
qr|WSREP:.*down context.*|,

View File

@@ -2430,3 +2430,50 @@ a b
1 1
unlock tables;
drop table t1,t2;
#
# MDEV-6179: dynamic columns functions/cast()/convert() doesn't
# play nice with CREATE/ALTER TABLE
#
create table t1 (
color char(32) as (COLUMN_GET(dynamic_cols, 1 as char)) persistent,
cl char(32) as (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) persistent,
item_name varchar(32) primary key, -- A common attribute for all items
i int,
dynamic_cols blob -- Dynamic columns will be stored here
);
INSERT INTO t1(item_name, dynamic_cols, i) VALUES
('MariaDB T-shirt', COLUMN_CREATE(1, 'blue', 2, 'XL'), 1);
INSERT INTO t1(item_name, dynamic_cols, i) VALUES
('Thinkpad Laptop', COLUMN_CREATE(1, 'black', 3, 500), 2);
select item_name, color, cl from t1;
item_name color cl
MariaDB T-shirt blue blue
Thinkpad Laptop black ttt
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`color` char(32) AS (COLUMN_GET(dynamic_cols, 1 as char)) PERSISTENT,
`cl` char(32) AS (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) PERSISTENT,
`item_name` varchar(32) NOT NULL,
`i` int(11) DEFAULT NULL,
`dynamic_cols` blob,
PRIMARY KEY (`item_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
n int,
c char(32) as (convert(cast(n as char), char)) persistent
);
insert into t1(n) values (1),(2),(3);
select * from t1;
n c
1 1
2 2
3 3
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`n` int(11) DEFAULT NULL,
`c` char(32) AS (convert(cast(n as char), char)) PERSISTENT
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;

View File

@@ -1198,5 +1198,14 @@ a 512
Warnings:
Warning 1260 Row 1 was cut by GROUP_CONCAT()
#
# MDEV-6865 Merge Bug#18935421 RPAD DIES WITH CERTAIN PADSTR INTPUTS..
#
DO RPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
Warnings:
Warning 1300 Invalid utf16 character string: 'DE9899'
DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
Warnings:
Warning 1300 Invalid utf16 character string: 'DE9899'
#
# End of 5.5 tests
#

View File

@@ -1,4 +1,5 @@
drop table if exists t1,t2,t3;
drop table if exists t0,t1,t2,t3;
drop database if exists test1;
set @exit_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=on,derived_with_keys=on';
set @save_optimizer_switch=@@optimizer_switch;
@@ -352,4 +353,155 @@ pk pk
72 72
80 80
drop table t1, t2, t3, t4;
#
# MDEV-6888: Query spends a long time in best_extension_by_limited_search with mrr enabled
#
create database test1;
use test1;
set @tmp_jcl= @@join_cache_level;
set @tmp_os= @@optimizer_switch;
set join_cache_level=8;
set optimizer_switch='mrr=on,mrr_sort_keys=on';
CREATE TABLE t0 (
f1 bigint(20) DEFAULT NULL,
f2 char(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
INSERT INTO t0 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(1,'one'),(2,'two');
CREATE TABLE t1 (
f1 decimal(64,30) DEFAULT NULL,
f2 varchar(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES
(NULL,'numeric column is NULL'),
(0.000000000000000000000000000000,NULL),
(5.000000000000000000000000000000,'five'),
(1.000000000000000000000000000000,'one'),
(3.000000000000000000000000000000,'three');
CREATE TABLE t2 (
f1 double DEFAULT NULL,
f2 varbinary(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(2,'two'),(3,'three');
create VIEW v0 AS select f1,f2 from t1 ;
create VIEW v1 AS select tab1_v1.f1,tab1_v1.f2 from t1 tab1_v1 join v0 tab2 on tab1_v1.f1 = tab2.f1 and tab1_v1.f2 = tab2.f2;
create VIEW v2 AS select tab1_v2.f1,tab1_v2.f2 from t2 tab1_v2 join v1 tab2 on tab1_v2.f1 = tab2.f1 and tab1_v2.f2 = tab2.f2;
create VIEW v3 AS select tab1_v3.f1,tab1_v3.f2 from t0 tab1_v3 join v2 tab2 on tab1_v3.f1 = tab2.f1 and tab1_v3.f2 = tab2.f2;
create VIEW v4 AS select tab1_v4.f1,tab1_v4.f2 from t1 tab1_v4 join v3 tab2 on tab1_v4.f1 = tab2.f1 and tab1_v4.f2 = tab2.f2;
create VIEW v5 AS select tab1_v5.f1,tab1_v5.f2 from t2 tab1_v5 join v4 tab2 on tab1_v5.f1 = tab2.f1 and tab1_v5.f2 = tab2.f2;
create VIEW v6 AS select tab1_v6.f1,tab1_v6.f2 from t0 tab1_v6 join v5 tab2 on tab1_v6.f1 = tab2.f1 and tab1_v6.f2 = tab2.f2;
create VIEW v7 AS select tab1_v7.f1,tab1_v7.f2 from t1 tab1_v7 join v6 tab2 on tab1_v7.f1 = tab2.f1 and tab1_v7.f2 = tab2.f2;
create VIEW v8 AS select tab1_v8.f1,tab1_v8.f2 from t2 tab1_v8 join v7 tab2 on tab1_v8.f1 = tab2.f1 and tab1_v8.f2 = tab2.f2;
create VIEW v9 AS select tab1_v9.f1,tab1_v9.f2 from t0 tab1_v9 join v8 tab2 on tab1_v9.f1 = tab2.f1 and tab1_v9.f2 = tab2.f2;
create VIEW v10 AS select tab1_v10.f1,tab1_v10.f2 from t1 tab1_v10 join v9 tab2 on tab1_v10.f1 = tab2.f1 and tab1_v10.f2 = tab2.f2;
create VIEW v11 AS select tab1_v11.f1,tab1_v11.f2 from t2 tab1_v11 join v10 tab2 on tab1_v11.f1 = tab2.f1 and tab1_v11.f2 = tab2.f2;
create VIEW v12 AS select tab1_v12.f1,tab1_v12.f2 from t0 tab1_v12 join v11 tab2 on tab1_v12.f1 = tab2.f1 and tab1_v12.f2 = tab2.f2;
create VIEW v13 AS select tab1_v13.f1,tab1_v13.f2 from t1 tab1_v13 join v12 tab2 on tab1_v13.f1 = tab2.f1 and tab1_v13.f2 = tab2.f2;
create VIEW v14 AS select tab1_v14.f1,tab1_v14.f2 from t2 tab1_v14 join v13 tab2 on tab1_v14.f1 = tab2.f1 and tab1_v14.f2 = tab2.f2;
create VIEW v15 AS select tab1_v15.f1,tab1_v15.f2 from t0 tab1_v15 join v14 tab2 on tab1_v15.f1 = tab2.f1 and tab1_v15.f2 = tab2.f2;
create VIEW v16 AS select tab1_v16.f1,tab1_v16.f2 from t1 tab1_v16 join v15 tab2 on tab1_v16.f1 = tab2.f1 and tab1_v16.f2 = tab2.f2;
create VIEW v17 AS select tab1_v17.f1,tab1_v17.f2 from t2 tab1_v17 join v16 tab2 on tab1_v17.f1 = tab2.f1 and tab1_v17.f2 = tab2.f2;
create VIEW v18 AS select tab1_v18.f1,tab1_v18.f2 from t0 tab1_v18 join v17 tab2 on tab1_v18.f1 = tab2.f1 and tab1_v18.f2 = tab2.f2;
create VIEW v19 AS select tab1_v19.f1,tab1_v19.f2 from t1 tab1_v19 join v18 tab2 on tab1_v19.f1 = tab2.f1 and tab1_v19.f2 = tab2.f2;
create VIEW v20 AS select tab1_v20.f1,tab1_v20.f2 from t2 tab1_v20 join v19 tab2 on tab1_v20.f1 = tab2.f1 and tab1_v20.f2 = tab2.f2;
create VIEW v21 AS select tab1_v21.f1,tab1_v21.f2 from t0 tab1_v21 join v20 tab2 on tab1_v21.f1 = tab2.f1 and tab1_v21.f2 = tab2.f2;
create VIEW v22 AS select tab1_v22.f1,tab1_v22.f2 from t1 tab1_v22 join v21 tab2 on tab1_v22.f1 = tab2.f1 and tab1_v22.f2 = tab2.f2;
create VIEW v23 AS select tab1_v23.f1,tab1_v23.f2 from t2 tab1_v23 join v22 tab2 on tab1_v23.f1 = tab2.f1 and tab1_v23.f2 = tab2.f2;
create VIEW v24 AS select tab1_v24.f1,tab1_v24.f2 from t0 tab1_v24 join v23 tab2 on tab1_v24.f1 = tab2.f1 and tab1_v24.f2 = tab2.f2;
create VIEW v25 AS select tab1_v25.f1,tab1_v25.f2 from t1 tab1_v25 join v24 tab2 on tab1_v25.f1 = tab2.f1 and tab1_v25.f2 = tab2.f2;
create VIEW v26 AS select tab1_v26.f1,tab1_v26.f2 from t2 tab1_v26 join v25 tab2 on tab1_v26.f1 = tab2.f1 and tab1_v26.f2 = tab2.f2;
create VIEW v27 AS select tab1_v27.f1,tab1_v27.f2 from t0 tab1_v27 join v26 tab2 on tab1_v27.f1 = tab2.f1 and tab1_v27.f2 = tab2.f2;
EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab1_v27 ALL NULL NULL NULL NULL 5 Using where
1 SIMPLE tab1_v26 hash_ALL NULL #hash#$hj 63 test1.tab1_v27.f1,test1.tab1_v27.f2 5 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE tab1_v25 hash_ALL NULL #hash#$hj 31 test1.tab1_v26.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v24 hash_ALL NULL #hash#$hj 60 test1.tab1_v25.f1,test1.tab1_v25.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v23 hash_ALL NULL #hash#$hj 63 test1.tab1_v24.f1,test1.tab1_v24.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v22 hash_ALL NULL #hash#$hj 31 test1.tab1_v23.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v21 hash_ALL NULL #hash#$hj 60 test1.tab1_v22.f1,test1.tab1_v22.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v20 hash_ALL NULL #hash#$hj 63 test1.tab1_v21.f1,test1.tab1_v21.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v19 hash_ALL NULL #hash#$hj 31 test1.tab1_v20.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v18 hash_ALL NULL #hash#$hj 60 test1.tab1_v19.f1,test1.tab1_v19.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v17 hash_ALL NULL #hash#$hj 63 test1.tab1_v18.f1,test1.tab1_v18.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v16 hash_ALL NULL #hash#$hj 31 test1.tab1_v17.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v15 hash_ALL NULL #hash#$hj 60 test1.tab1_v16.f1,test1.tab1_v16.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v14 hash_ALL NULL #hash#$hj 63 test1.tab1_v15.f1,test1.tab1_v15.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v13 hash_ALL NULL #hash#$hj 31 test1.tab1_v14.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v12 hash_ALL NULL #hash#$hj 60 test1.tab1_v13.f1,test1.tab1_v13.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v11 hash_ALL NULL #hash#$hj 63 test1.tab1_v12.f1,test1.tab1_v12.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v10 hash_ALL NULL #hash#$hj 31 test1.tab1_v11.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v9 hash_ALL NULL #hash#$hj 60 test1.tab1_v10.f1,test1.tab1_v10.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v8 hash_ALL NULL #hash#$hj 63 test1.tab1_v9.f1,test1.tab1_v9.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v7 hash_ALL NULL #hash#$hj 31 test1.tab1_v8.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v6 hash_ALL NULL #hash#$hj 60 test1.tab1_v7.f1,test1.tab1_v7.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v5 hash_ALL NULL #hash#$hj 63 test1.tab1_v6.f1,test1.tab1_v6.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v4 hash_ALL NULL #hash#$hj 31 test1.tab1_v5.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v3 hash_ALL NULL #hash#$hj 60 test1.tab1_v4.f1,test1.tab1_v4.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v2 hash_ALL NULL #hash#$hj 63 test1.tab1_v3.f1,test1.tab1_v3.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v1 hash_ALL NULL #hash#$hj 31 test1.tab1_v2.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t1 hash_ALL NULL #hash#$hj 85 test1.tab1_v1.f1,test1.tab1_v1.f2 5 Using where; Using join buffer (incremental, BNLH join)
# This used to hang forever:
EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab1_v27 ALL NULL NULL NULL NULL 5 Using where
1 SIMPLE tab1_v26 hash_ALL NULL #hash#$hj 63 test1.tab1_v27.f1,test1.tab1_v27.f2 5 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE tab1_v25 hash_ALL NULL #hash#$hj 31 test1.tab1_v26.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v24 hash_ALL NULL #hash#$hj 60 test1.tab1_v25.f1,test1.tab1_v25.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v23 hash_ALL NULL #hash#$hj 63 test1.tab1_v24.f1,test1.tab1_v24.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v22 hash_ALL NULL #hash#$hj 31 test1.tab1_v23.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v21 hash_ALL NULL #hash#$hj 60 test1.tab1_v22.f1,test1.tab1_v22.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v20 hash_ALL NULL #hash#$hj 63 test1.tab1_v21.f1,test1.tab1_v21.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v19 hash_ALL NULL #hash#$hj 31 test1.tab1_v20.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v18 hash_ALL NULL #hash#$hj 60 test1.tab1_v19.f1,test1.tab1_v19.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v17 hash_ALL NULL #hash#$hj 63 test1.tab1_v18.f1,test1.tab1_v18.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v16 hash_ALL NULL #hash#$hj 31 test1.tab1_v17.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v15 hash_ALL NULL #hash#$hj 60 test1.tab1_v16.f1,test1.tab1_v16.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v14 hash_ALL NULL #hash#$hj 63 test1.tab1_v15.f1,test1.tab1_v15.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v13 hash_ALL NULL #hash#$hj 31 test1.tab1_v14.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v12 hash_ALL NULL #hash#$hj 60 test1.tab1_v13.f1,test1.tab1_v13.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v11 hash_ALL NULL #hash#$hj 63 test1.tab1_v12.f1,test1.tab1_v12.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v10 hash_ALL NULL #hash#$hj 31 test1.tab1_v11.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v9 hash_ALL NULL #hash#$hj 60 test1.tab1_v10.f1,test1.tab1_v10.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v8 hash_ALL NULL #hash#$hj 63 test1.tab1_v9.f1,test1.tab1_v9.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v7 hash_ALL NULL #hash#$hj 31 test1.tab1_v8.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v6 hash_ALL NULL #hash#$hj 60 test1.tab1_v7.f1,test1.tab1_v7.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v5 hash_ALL NULL #hash#$hj 63 test1.tab1_v6.f1,test1.tab1_v6.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v4 hash_ALL NULL #hash#$hj 31 test1.tab1_v5.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v3 hash_ALL NULL #hash#$hj 60 test1.tab1_v4.f1,test1.tab1_v4.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v2 hash_ALL NULL #hash#$hj 63 test1.tab1_v3.f1,test1.tab1_v3.f2 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE tab1_v1 hash_ALL NULL #hash#$hj 31 test1.tab1_v2.f1 5 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t1 hash_ALL NULL #hash#$hj 85 test1.tab1_v1.f1,test1.tab1_v1.f2 5 Using where; Using join buffer (incremental, BNLH join)
use test;
drop database test1;
set join_cache_level=@tmp_jcl;
set optimizer_switch=@tmp_os;
#
# MDEV-6879: Dereference of NULL primary_file->table in DsMrr_impl::get_disk_sweep_mrr_cost()
#
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int, b int, c text);
insert into t2
select
A.a + B.a* 10,
A.a + B.a* 10,
'blob-data'
from t1 A, t1 B;
set @tmp_jcl= @@join_cache_level;
set @tmp_os= @@optimizer_switch;
set join_cache_level=6;
set @@optimizer_switch='derived_merge=on,derived_with_keys=on,mrr=on';
explain
select * from
t1 join
(select * from t2 order by a limit 1000) as D1
where
D1.a= t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where
1 PRIMARY <derived2> hash_ALL key0 #hash#key0 5 test.t1.a 100 Using join buffer (flat, BNLH join)
2 DERIVED t2 ALL NULL NULL NULL NULL 100 Using filesort
set join_cache_level=@tmp_jcl;
set optimizer_switch=@tmp_os;
drop table t1, t2;
set optimizer_switch=@exit_optimizer_switch;

View File

@@ -147,3 +147,11 @@ DROP TABLE t1;
#
# End of 5.3 tests
#
SELECT UNCOMPRESS(CAST(0 AS BINARY(5)));
UNCOMPRESS(CAST(0 AS BINARY(5)))
NULL
Warnings:
Warning 1259 ZLIB: Input data corrupted
#
# End of 5.5 tests
#

View File

@@ -2561,3 +2561,27 @@ Warning 1292 Truncated incorrect time value: '9336:00:00'
Warning 1292 Truncated incorrect time value: '2952:00:00'
Warning 1292 Truncated incorrect time value: '2952:00:00'
DROP TABLE t1;
#
# MDEV-7221 from_days fails after null value
#
CREATE TABLE t1 (
id INT(11) NOT NULL PRIMARY KEY,
date1 DATE NULL DEFAULT NULL
);
INSERT INTO t1 VALUES (12, '2011-05-12');
INSERT INTO t1 VALUES (13, NULL);
INSERT INTO t1 VALUES (14, '2009-10-23');
INSERT INTO t1 VALUES (15, '2014-10-30');
INSERT INTO t1 VALUES (16, NULL);
INSERT INTO t1 VALUES (17, NULL);
INSERT INTO t1 VALUES (18, '2010-10-13');
SELECT a.id,a.date1,FROM_DAYS(TO_DAYS(a.date1)-10) as date2, DATE_ADD(a.date1,INTERVAL -10 DAY),TO_DAYS(a.date1)-10 FROM t1 a ORDER BY a.id;
id date1 date2 DATE_ADD(a.date1,INTERVAL -10 DAY) TO_DAYS(a.date1)-10
12 2011-05-12 2011-05-02 2011-05-02 734624
13 NULL NULL NULL NULL
14 2009-10-23 2009-10-13 2009-10-13 734058
15 2014-10-30 2014-10-20 2014-10-20 735891
16 NULL NULL NULL NULL
17 NULL NULL NULL NULL
18 2010-10-13 2010-10-03 2010-10-03 734413
DROP TABLE t1;

File diff suppressed because one or more lines are too long

View File

@@ -1546,6 +1546,12 @@ Warnings:
Warning 1300 Invalid utf8 character string: 'E043'
Warning 1300 Invalid utf8 character string: 'E043'
drop table t1;
#
# MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0))
#
select st_within(GeomFromText('Polygon((0 0))'), Point(0,0));
st_within(GeomFromText('Polygon((0 0))'), Point(0,0))
1
End of 5.3 tests
#
# Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE

View File

@@ -2482,3 +2482,28 @@ test
1
2
SET sql_mode='';
#
# MDEV-6484: Assertion `tab->ref.use_count' failed on query with joins, constant table, multi-part key
#
CREATE TABLE t1 (i1 INT, c1 VARCHAR(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (6,'b');
CREATE TABLE t2 (pk2 INT, i2 INT, c2 VARCHAR(1), PRIMARY KEY(pk2), KEY(pk2,i2)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,2,'s'),(2,4,'r'),(3,8,'m'),(4,4,'b'),(5,4,'x'),(6,7,'g'),(7,4,'p');
SELECT i2 FROM t1 AS t1a STRAIGHT_JOIN ( t2 INNER JOIN t1 AS t1b ON (t1b.c1 = c2) ) ON (t1b.i1 = pk2 )
WHERE t1a.c1 = c2 GROUP BY i2;
i2
DROP TABLE t1,t2;
#
# MDEV-6855
# MIN(*) with subqueries with IS NOT NULL in WHERE clause crashed.
#
CREATE TABLE t1 (i INT, c VARCHAR(3), KEY(c,i)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (7,'foo'),(0,'bar');
CREATE TABLE t2 (j INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (0),(8),(1),(8),(9);
SELECT MAX(i), c FROM t1
WHERE c != 'qux' AND ( SELECT SUM(j) FROM t1, t2 ) IS NOT NULL GROUP BY c;
MAX(i) c
0 bar
7 foo
drop table t1,t2;

View File

@@ -1554,7 +1554,9 @@ show open tables where f1()=0;
drop table t1;
drop function f1;
select * from information_schema.tables where 1=sleep(100000);
Got one of the listed errors
select * from information_schema.columns where 1=sleep(100000);
Got one of the listed errors
explain select count(*) from information_schema.tables;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tables ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases

View File

@@ -109,3 +109,12 @@
select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
a b c filler a b
set optimizer_switch='index_condition_pushdown=on';
@@ -170,7 +170,7 @@
select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 10
-1 SIMPLE t1 ref kp1 kp1 32 test.t2.a 1 Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE t1 ref kp1 kp1 32 test.t2.a 1
select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a;
a pk kp1 col1
kp1-1000 pk-1000 kp1-1000 val-1000

View File

@@ -145,11 +145,47 @@ select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
a b c filler a b
set optimizer_switch='index_condition_pushdown=on';
drop table t1,t2;
set @@join_cache_level= @save_join_cache_level;
set storage_engine=@save_storage_engine;
set optimizer_switch=@innodb_mrr_cpk_tmp;
drop table t0;
#
# MDEV-6878: Use of uninitialized saved_primary_key in Mrr_ordered_index_reader::resume_read()
#
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (
pk varchar(32) character set utf8 primary key,
kp1 char(32) not null,
col1 varchar(32),
key (kp1)
) engine=innodb;
insert into t1
select
concat('pk-', 1000 +A.a),
concat('kp1-', 1000 +A.a),
concat('val-', 1000 +A.a)
from test.t0 A ;
create table t2 as select kp1 as a from t1;
set join_cache_level=8;
set optimizer_switch='mrr=on,mrr_sort_keys=on';
explain
select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 10
1 SIMPLE t1 ref kp1 kp1 32 test.t2.a 1 Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a;
a pk kp1 col1
kp1-1000 pk-1000 kp1-1000 val-1000
kp1-1001 pk-1001 kp1-1001 val-1001
kp1-1002 pk-1002 kp1-1002 val-1002
kp1-1003 pk-1003 kp1-1003 val-1003
kp1-1004 pk-1004 kp1-1004 val-1004
kp1-1005 pk-1005 kp1-1005 val-1005
kp1-1006 pk-1006 kp1-1006 val-1006
kp1-1007 pk-1007 kp1-1007 val-1007
kp1-1008 pk-1008 kp1-1008 val-1008
kp1-1009 pk-1009 kp1-1009 val-1009
drop table t0,t1,t2;
#
#
# MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions
#
set @tmp_mdev3817=@@optimizer_switch;
@@ -194,3 +230,9 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DERIVED t2 ALL NULL NULL NULL NULL #
set join_cache_level= @tmp_mdev5037;
drop table t0,t1,t2;
#
# This must be at the end:
#
set @@join_cache_level= @save_join_cache_level;
set storage_engine=@save_storage_engine;
set optimizer_switch=@innodb_mrr_cpk_tmp;

View File

@@ -498,8 +498,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join)
1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join)
1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -576,8 +576,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join)
1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join)
1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -654,8 +654,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -732,8 +732,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND

View File

@@ -2222,4 +2222,27 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and (`test`.`t3`.`i3` = `test`.`t1`.`i1`))) where ((`test`.`t3`.`d3` = 0) or isnull(`test`.`t3`.`d3`))
DROP TABLE t1,t2,t3;
#
# Bug mdev-6705: wrong on expression after constant row substitution
# that triggers a simplification of WHERE condition
#
CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (10,8);
CREATE TABLE t2 (c int) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8),(9);
CREATE TABLE t3 (d int) ENGINE=MyISAM;
INSERT INTO t3 VALUES (3),(8);
EXPLAIN EXTENDED
SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
WHERE b IN (1,2,3) OR b = d;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`d` = 10)) where ((`test`.`t2`.`c` = 8) and (`test`.`t3`.`d` = 8))
SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
WHERE b IN (1,2,3) OR b = d;
a b c d
DROP TABLE t1,t2,t3;
SET optimizer_switch=@save_optimizer_switch;

View File

@@ -2233,6 +2233,29 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and (`test`.`t3`.`i3` = `test`.`t1`.`i1`))) where ((`test`.`t3`.`d3` = 0) or isnull(`test`.`t3`.`d3`))
DROP TABLE t1,t2,t3;
#
# Bug mdev-6705: wrong on expression after constant row substitution
# that triggers a simplification of WHERE condition
#
CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (10,8);
CREATE TABLE t2 (c int) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8),(9);
CREATE TABLE t3 (d int) ENGINE=MyISAM;
INSERT INTO t3 VALUES (3),(8);
EXPLAIN EXTENDED
SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
WHERE b IN (1,2,3) OR b = d;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`d` = 10)) where ((`test`.`t2`.`c` = 8) and (`test`.`t3`.`d` = 8))
SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
WHERE b IN (1,2,3) OR b = d;
a b c d
DROP TABLE t1,t2,t3;
SET optimizer_switch=@save_optimizer_switch;
set join_cache_level=default;
show variables like 'join_cache_level';

View File

@@ -0,0 +1,10 @@
#
# MDEV-6896 kill user command cause MariaDB crash!
#
create user foo@'127.0.0.1';
select user from information_schema.processlist;
user
foo
root
kill user foo@'127.0.0.1';
drop user foo@'127.0.0.1';

View File

@@ -5,9 +5,8 @@ a VARCHAR(100),
INDEX(a)
) ENGINE=MyISAM;
ALTER TABLE t1 DISABLE KEYS;
SET debug_sync= 'myisam_after_repair_by_sort SIGNAL waiting WAIT_FOR go';
SET debug_sync= 'myisam_after_repair_by_sort WAIT_FOR go';
ALTER TABLE t1 ENABLE KEYS;
SET debug_sync= 'now WAIT_FOR waiting';
SET debug_sync= 'now SIGNAL go';
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment

View File

@@ -7,6 +7,8 @@ grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA
grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB" ISSUER "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB";
grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx";
flush privileges;
connect(localhost,ssl_user2,,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'ssl_user2'@'localhost' (using password: NO)
connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'ssl_user5'@'localhost' (using password: NO)
SHOW STATUS LIKE 'Ssl_cipher';

View File

@@ -0,0 +1,25 @@
grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA";
grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256";
TLS1.2 ciphers: user is ok with any cipher
ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA
ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256
ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
SSLv3 ciphers: user is ok with any cipher
Variable_name Value
Ssl_cipher RC4-SHA
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA
Variable_name Value
Ssl_cipher RC4-SHA
ERROR 1045 (28000): Access denied for user 'ssl_sslv3'@'localhost' (using password: NO)
SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256
ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO)
drop user ssl_sslv3@localhost;
drop user ssl_tls12@localhost;

View File

@@ -0,0 +1,25 @@
grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA";
grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256";
TLS1.2 ciphers: user is ok with any cipher
Variable_name Value
Ssl_cipher AES128-SHA256
Variable_name Value
Ssl_cipher DHE-RSA-AES256-GCM-SHA384
TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA
ERROR 1045 (28000): Access denied for user 'ssl_sslv3'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'ssl_sslv3'@'localhost' (using password: NO)
TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256
Variable_name Value
Ssl_cipher AES128-SHA256
ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO)
SSLv3 ciphers: user is ok with any cipher
ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA
ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256
ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
drop user ssl_sslv3@localhost;
drop user ssl_tls12@localhost;

View File

@@ -1754,3 +1754,8 @@ PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
DROP TABLE t1;
End of 5.1 tests
create table t1 (a int) partition by list (values(a) div 1) (partition p0 values in (0), partition p1 values in (1));
ERROR HY000: This partition function is not allowed
create table t1 (a int) partition by list (uuid_short()) (partition p0 values in (0), partition p1 values in (1));
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ') (partition p0 values in (0), partition p1 values in (1))' at line 1
End of 5.5 tests

View File

@@ -1,15 +1,19 @@
SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time';
SELECT 1;
SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed';
SELECT INFO,TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO IS NULL;
SELECT ID, TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE CONCAT(":", ID, ":") = ":TID:";
1
1
SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
INFO TIME TIME_MS
NULL 0 0.000
ID TIME TIME_MS
TID 0 0.000
SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done EXECUTE 2';
SET DEBUG_SYNC= 'now WAIT_FOR query_done';
SET DEBUG_SYNC= 'now SIGNAL nosignal';
select sleep(5);
sleep(5)
0
SET DEBUG_SYNC = 'now WAIT_FOR query_done';
select command, time < 5 from information_schema.processlist where id != connection_id();
command time < 5
Sleep 1

View File

@@ -1935,3 +1935,23 @@ id select_type table type possible_keys key key_len ref rows Extra
3 UNION t1 ALL NULL NULL NULL NULL 4
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
drop table t1;
#
# MDEV-6868:MariaDB server crash ( select with union and order by
# with subquery )
#
CREATE TABLE t1 ( id INTEGER, sample_name1 VARCHAR(100), sample_name2 VARCHAR(100), PRIMARY KEY(id) );
INSERT INTO t1 ( id, sample_name1, sample_name2 ) VALUES ( 1, 'aaaa', 'bbbb' ), ( 2, 'cccc', 'dddd' );
(
SELECT sample_name1 AS testname FROM t1
)
UNION
(
SELECT sample_name2 AS testname FROM t1 C ORDER BY (SELECT T.sample_name1 FROM t1 T WHERE T.id = C.id)
)
;
testname
aaaa
cccc
bbbb
dddd
drop table t1;

View File

@@ -39,6 +39,9 @@ sub skip_combinations {
}
$skip{'include/check_ipv6.inc'} = 'No IPv6' unless ipv6_ok();
$skip{'t/openssl_6975.test'} = 'no or too old openssl'
unless ! IS_WINDOWS and ! system "openssl ciphers TLSv1.2 2>&1 >/dev/null";
%skip;
}

View File

@@ -0,0 +1,22 @@
create table t1 (i int, j int);
create view v1 as select i from t1;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 (i);
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' INTO TABLE v1;
select * from v1;
i
1
1
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (i int, j int)
master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select i from t1
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' IGNORE INTO TABLE `v1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`i`) ;file_id=#
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' IGNORE INTO TABLE `v1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`i`) ;file_id=#
master-bin.000001 # Query # # COMMIT
drop view v1;
drop table t1;

View File

@@ -0,0 +1,20 @@
#
# MDEV-3940 Server crash or assertion `item->type() == Item::STRING_ITEM' failure on LOAD DATA through a view with statement binary logging
#
--source include/have_binlog_format_statement.inc
--write_file $MYSQLTEST_VARDIR/3940.data
1
EOF
create table t1 (i int, j int);
create view v1 as select i from t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 (i)
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/3940.data' INTO TABLE v1
select * from v1;
--source include/show_binlog_events.inc
drop view v1;
drop table t1;

View File

@@ -0,0 +1,4 @@
Variable_name Value
innodb_stats_sample_pages 1
Variable_name Value
innodb_stats_traditional OFF

View File

@@ -9,6 +9,8 @@
--source include/not_embedded.inc
# DBUG_SUICIDE() hangs under valgrind
--source include/not_valgrind.inc
# No windows, need perl
--source include/not_windows.inc
# The flag innodb_change_buffering_debug is only available in debug builds.
# It instructs InnoDB to try to evict pages from the buffer pool when

View File

@@ -0,0 +1,78 @@
--source include/have_innodb.inc
#
# Test that mysqld does not crash when running ANALYZE TABLE with
# different values of the parameter innodb_stats_sample_pages.
#
# we care only that the following SQL commands do not produce errors
# and do not crash the server
-- disable_query_log
-- disable_result_log
-- enable_warnings
let $sample_pages=`select @@innodb_stats_sample_pages`;
let $traditional=`select @@innodb_stats_traditional`;
SET GLOBAL innodb_stats_sample_pages=0;
#use new method to calculate statistics
SET GLOBAL innodb_stats_traditional=0;
# check that the value has been adjusted to 1
-- enable_result_log
SHOW VARIABLES LIKE 'innodb_stats_sample_pages';
SHOW VARIABLES LIKE 'innodb_stats_traditional';
-- disable_result_log
CREATE TABLE innodb_analyze (
a INT,
b INT,
c char(50),
KEY(a),
KEY(b,a)
) ENGINE=InnoDB;
# test with empty table
ANALYZE TABLE innodb_analyze;
SET GLOBAL innodb_stats_sample_pages=2;
ANALYZE TABLE innodb_analyze;
SET GLOBAL innodb_stats_sample_pages=1;
ANALYZE TABLE innodb_analyze;
SET GLOBAL innodb_stats_sample_pages=8000;
ANALYZE TABLE innodb_analyze;
delimiter //;
create procedure innodb_insert_proc (repeat_count int)
begin
declare current_num int;
set current_num = 0;
while current_num < repeat_count do
insert into innodb_analyze values(current_num, current_num*100,substring(MD5(RAND()), -44));
set current_num = current_num + 1;
end while;
end//
delimiter ;//
commit;
set autocommit=0;
call innodb_insert_proc(7000);
commit;
set autocommit=1;
SET GLOBAL innodb_stats_sample_pages=1;
ANALYZE TABLE innodb_analyze;
SET GLOBAL innodb_stats_sample_pages=8;
ANALYZE TABLE innodb_analyze;
SET GLOBAL innodb_stats_sample_pages=16;
ANALYZE TABLE innodb_analyze;
SET GLOBAL innodb_stats_sample_pages=8000;
ANALYZE TABLE innodb_analyze;
DROP PROCEDURE innodb_insert_proc;
DROP TABLE innodb_analyze;
EVAL SET GLOBAL innodb_stats_sample_pages=$sample_pages;
EVAL SET GLOBAL innodb_stats_traditional=$traditional;

View File

@@ -1333,7 +1333,7 @@ drop table t1;
# Test for testable InnoDB status variables. This test
# uses previous ones(pages_created, rows_deleted, ...).
--replace_result 511 ok 512 ok 2047 ok 513 ok
--replace_result 511 ok 512 ok 2047 ok 513 ok 515 ok
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';

View File

@@ -10,6 +10,8 @@ if (`select count(*)=0 from information_schema.global_variables where variable_n
# Don't test under valgrind, undo slots of the previous test might exist still
# and cause unstable result.
--source include/not_valgrind.inc
# undo slots of the previous test might exist still
--source include/not_windows.inc
call mtr.add_suppression("InnoDB: Warning: cannot find a free slot for an undo log. Do you have too");

View File

@@ -12,6 +12,9 @@ source include/not_embedded.inc;
source include/have_innodb.inc;
# Require Debug for SET DEBUG
source include/have_debug.inc;
# Test could open crash reporter on Windows
# if compiler set up
source include/not_windows.inc;
CALL mtr.add_suppression("InnoDB: Error: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
CALL mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");

View File

@@ -122,7 +122,7 @@ SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE;
# then its contents will never change because the cache from which it is
# filled is updated only if it has not been read for 0.1 seconds. See
# CACHE_MIN_IDLE_TIME_US in trx/trx0i_s.c.
let $cnt=10;
let $cnt=200;
while ($cnt)
{
let $success=`SELECT COUNT(*) = 14 FROM INFORMATION_SCHEMA.INNODB_LOCKS`;

View File

@@ -0,0 +1,6 @@
create table t1 (pk int primary key) engine=Aria;
insert into t1 values (1);
insert into t1 select sleep(2)+1 from t1;
insert into t1 select 2 from t1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
drop table t1;

View File

@@ -0,0 +1,21 @@
#
# MDEV-4010
# Deadlock on concurrent INSERT .. SELECT into an Aria table with statement
# binary logging
#
--source include/have_binlog_format_statement.inc
create table t1 (pk int primary key) engine=Aria;
insert into t1 values (1);
send insert into t1 select sleep(2)+1 from t1;
--connect (con1,localhost,root,,)
insert into t1 select 2 from t1;
--connection default
--error 1062
--reap
--disconnect con1
drop table t1;

View File

@@ -1 +1 @@
--performance_schema_events_waits_history_long_size=5000
--loose-performance_schema_events_waits_history_long_size=5000

View File

@@ -12,11 +12,14 @@ eval install plugin unix_socket soname '$AUTH_SOCKET_SO';
--echo # with named user
--echo #
--replace_result $USER USER
--let $replace=create user $USER
--replace_result $replace "create user USER"
eval create user $USER identified via unix_socket;
--write_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt
--replace_result $USER USER
--let $replace1=$USER@localhost
--let $replace2=$USER@%
--replace_result $replace1 "USER@localhost" $replace2 "USER@%"
select user(), current_user(), database();
EOF
@@ -31,7 +34,8 @@ EOF
--error 1
--exec $MYSQL_TEST -u foobar --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
--replace_result $USER USER
--let $replace=drop user $USER
--replace_result $replace "drop user USER"
eval drop user $USER;
--echo #

File diff suppressed because one or more lines are too long

View File

@@ -7,7 +7,6 @@ SHOW BINLOG EVENTS;
SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
FLUSH LOGS;
SET DEBUG_SYNC= 'now SIGNAL end';
SET DEBUG_SYNC= 'RESET';
[connection slave]
SET DEBUG_SYNC= 'RESET';
include/rpl_end.inc

View File

@@ -0,0 +1,2 @@
--log-slave-updates=0
--skip_external_locking=0

File diff suppressed because one or more lines are too long

View File

@@ -22,7 +22,6 @@ SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR
SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
FLUSH LOGS;
SET DEBUG_SYNC= 'now SIGNAL end';
SET DEBUG_SYNC= 'RESET';
--echo [connection slave]
--connection slave

View File

@@ -25,6 +25,11 @@ let $field= Server_id;
# 3 is server_id of slave2.
let $condition= ='3';
source include/wait_show_condition.inc;
# Make sure that the other slave also had time to register. Otherwise we get
# occasional spurious failures where server_id=2 is missing from SHOW SLAVE
# HOSTS, when that slave is much slower to register due to thread scheduling.
let $condition= ='2';
source include/wait_show_condition.inc;
--replace_column 3 'SLAVE_PORT'
--replace_result $SLAVE_MYPORT SLAVE_PORT $DEFAULT_MASTER_PORT DEFAULT_PORT
SHOW SLAVE HOSTS;

View File

@@ -56,10 +56,14 @@ XA PREPARE 'xa2';
--connection default
--enable_reconnect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
wait
EOF
--shutdown_server 0
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
--source include/wait_until_connected_again.inc
XA RECOVER;
XA ROLLBACK 'xa1';

View File

@@ -0,0 +1,56 @@
SET @start_global_value = @@global.innodb_stats_modified_counter;
SELECT @start_global_value;
@start_global_value
0
Valid values are one or above
select @@global.innodb_stats_modified_counter >=1;
@@global.innodb_stats_modified_counter >=1
0
select @@global.innodb_stats_modified_counter;
@@global.innodb_stats_modified_counter
0
select @@session.innodb_stats_modified_counter;
ERROR HY000: Variable 'innodb_stats_modified_counter' is a GLOBAL variable
show global variables like 'innodb_stats_modified_counter';
Variable_name Value
innodb_stats_modified_counter 0
show session variables like 'innodb_stats_modified_counter';
Variable_name Value
innodb_stats_modified_counter 0
select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_MODIFIED_COUNTER 0
select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_MODIFIED_COUNTER 0
set global innodb_stats_modified_counter=10;
select @@global.innodb_stats_modified_counter;
@@global.innodb_stats_modified_counter
10
select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_MODIFIED_COUNTER 10
select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_MODIFIED_COUNTER 10
set session innodb_stats_modified_counter=1;
ERROR HY000: Variable 'innodb_stats_modified_counter' is a GLOBAL variable and should be set with SET GLOBAL
set global innodb_stats_modified_counter=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_stats_modified_counter'
set global innodb_stats_modified_counter=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_stats_modified_counter'
set global innodb_stats_modified_counter="foo";
ERROR 42000: Incorrect argument type to variable 'innodb_stats_modified_counter'
set global innodb_stats_modified_counter=-7;
Warnings:
Warning 1292 Truncated incorrect innodb_stats_modified_counter value: '-7'
select @@global.innodb_stats_modified_counter;
@@global.innodb_stats_modified_counter
0
select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_MODIFIED_COUNTER 0
SET @@global.innodb_stats_modified_counter = @start_global_value;
SELECT @@global.innodb_stats_modified_counter;
@@global.innodb_stats_modified_counter
0

View File

@@ -0,0 +1,92 @@
SET @start_global_value = @@global.innodb_stats_traditional;
SELECT @start_global_value;
@start_global_value
1
Valid values are 'ON' and 'OFF'
select @@global.innodb_stats_traditional in (0, 1);
@@global.innodb_stats_traditional in (0, 1)
1
select @@global.innodb_stats_traditional;
@@global.innodb_stats_traditional
1
select @@session.innodb_stats_traditional;
ERROR HY000: Variable 'innodb_stats_traditional' is a GLOBAL variable
show global variables like 'innodb_stats_traditional';
Variable_name Value
innodb_stats_traditional ON
show session variables like 'innodb_stats_traditional';
Variable_name Value
innodb_stats_traditional ON
select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_TRADITIONAL ON
select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_TRADITIONAL ON
set global innodb_stats_traditional='OFF';
select @@global.innodb_stats_traditional;
@@global.innodb_stats_traditional
0
select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_TRADITIONAL OFF
select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_TRADITIONAL OFF
set @@global.innodb_stats_traditional=1;
select @@global.innodb_stats_traditional;
@@global.innodb_stats_traditional
1
select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_TRADITIONAL ON
select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_TRADITIONAL ON
set global innodb_stats_traditional=0;
select @@global.innodb_stats_traditional;
@@global.innodb_stats_traditional
0
select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_TRADITIONAL OFF
select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_TRADITIONAL OFF
set @@global.innodb_stats_traditional='ON';
select @@global.innodb_stats_traditional;
@@global.innodb_stats_traditional
1
select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_TRADITIONAL ON
select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_TRADITIONAL ON
set session innodb_stats_traditional='OFF';
ERROR HY000: Variable 'innodb_stats_traditional' is a GLOBAL variable and should be set with SET GLOBAL
set @@session.innodb_stats_traditional='ON';
ERROR HY000: Variable 'innodb_stats_traditional' is a GLOBAL variable and should be set with SET GLOBAL
set global innodb_stats_traditional=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_stats_traditional'
set global innodb_stats_traditional=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_stats_traditional'
set global innodb_stats_traditional=2;
ERROR 42000: Variable 'innodb_stats_traditional' can't be set to the value of '2'
set global innodb_stats_traditional=-3;
ERROR 42000: Variable 'innodb_stats_traditional' can't be set to the value of '-3'
select @@global.innodb_stats_traditional;
@@global.innodb_stats_traditional
1
select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_TRADITIONAL ON
select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
VARIABLE_NAME VARIABLE_VALUE
INNODB_STATS_TRADITIONAL ON
set global innodb_stats_traditional='AUTO';
ERROR 42000: Variable 'innodb_stats_traditional' can't be set to the value of 'AUTO'
SET @@global.innodb_stats_traditional = @start_global_value;
SELECT @@global.innodb_stats_traditional;
@@global.innodb_stats_traditional
1

View File

@@ -0,0 +1,47 @@
--source include/have_innodb.inc
SET @start_global_value = @@global.innodb_stats_modified_counter;
SELECT @start_global_value;
#
# exists as global only
#
--echo Valid values are one or above
select @@global.innodb_stats_modified_counter >=1;
select @@global.innodb_stats_modified_counter;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_stats_modified_counter;
show global variables like 'innodb_stats_modified_counter';
show session variables like 'innodb_stats_modified_counter';
select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter';
select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter';
#
# show that it's writable
#
set global innodb_stats_modified_counter=10;
select @@global.innodb_stats_modified_counter;
select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter';
select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter';
--error ER_GLOBAL_VARIABLE
set session innodb_stats_modified_counter=1;
#
# incorrect types
#
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_stats_modified_counter=1.1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_stats_modified_counter=1e1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_stats_modified_counter="foo";
set global innodb_stats_modified_counter=-7;
select @@global.innodb_stats_modified_counter;
select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter';
#
# cleanup
#
SET @@global.innodb_stats_modified_counter = @start_global_value;
SELECT @@global.innodb_stats_modified_counter;

View File

@@ -0,0 +1,65 @@
--source include/have_innodb.inc
SET @start_global_value = @@global.innodb_stats_traditional;
SELECT @start_global_value;
#
# exists as global only
#
--echo Valid values are 'ON' and 'OFF'
select @@global.innodb_stats_traditional in (0, 1);
select @@global.innodb_stats_traditional;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_stats_traditional;
show global variables like 'innodb_stats_traditional';
show session variables like 'innodb_stats_traditional';
select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
#
# show that it's writable
#
set global innodb_stats_traditional='OFF';
select @@global.innodb_stats_traditional;
select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
set @@global.innodb_stats_traditional=1;
select @@global.innodb_stats_traditional;
select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
set global innodb_stats_traditional=0;
select @@global.innodb_stats_traditional;
select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
set @@global.innodb_stats_traditional='ON';
select @@global.innodb_stats_traditional;
select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
--error ER_GLOBAL_VARIABLE
set session innodb_stats_traditional='OFF';
--error ER_GLOBAL_VARIABLE
set @@session.innodb_stats_traditional='ON';
#
# incorrect types
#
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_stats_traditional=1.1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_stats_traditional=1e1;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_stats_traditional=2;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_stats_traditional=-3;
select @@global.innodb_stats_traditional;
select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_stats_traditional='AUTO';
#
# Cleanup
#
SET @@global.innodb_stats_traditional = @start_global_value;
SELECT @@global.innodb_stats_traditional;

View File

@@ -0,0 +1,67 @@
set lc_time_names = 'es_MX';
set time_zone='+10:00';
set div_precision_increment=20;
create table t1 (a int, b int, v decimal(20,19) as (a/3));
create table t2 (a int, b int, v int as (a+@a));
ERROR HY000: Function or expression is not allowed for column 'v'
create table t3 (a int, b int, v int as (a+@@error_count));
ERROR HY000: Function or expression is not allowed for column 'v'
create table t4 (a int, b int, v int as (@a:=a));
ERROR HY000: Function or expression is not allowed for column 'v'
create table t5 (a int, b int, v varchar(100) as (monthname(a)));
create table t6 (a int, b int, v varchar(100) as (dayname(a)));
create table t7 (a int, b int, v varchar(100) as (date_format(a, '%W %a %M %b')));
create table t8 (a int, b int, v varchar(100) as (from_unixtime(a)));
insert t1 (a,b) values (1,2);
insert t5 (a,b) values (20141010,2);
insert t6 (a,b) values (20141010,2);
insert t7 (a,b) values (20141010,2);
insert t8 (a,b) values (1234567890,2);
select * from t1;
a b v
1 2 0.3333333333333333333
select * from t5;
a b v
20141010 2 octubre
select * from t6;
a b v
20141010 2 viernes
select * from t7;
a b v
20141010 2 viernes vie octubre oct
select * from t8;
a b v
1234567890 2 2009-02-14 09:31:30
set time_zone='+1:00';
select * from t1;
a b v
1 2 0.3333333333333333333
select * from t5;
a b v
20141010 2 octubre
select * from t6;
a b v
20141010 2 viernes
select * from t7;
a b v
20141010 2 viernes vie octubre oct
select * from t8;
a b v
1234567890 2 2009-02-14 09:31:30
flush tables;
select * from t1;
a b v
1 2 0.3333333330000000000
select * from t5;
a b v
20141010 2 October
select * from t6;
a b v
20141010 2 Friday
select * from t7;
a b v
20141010 2 Friday Fri October Oct
select * from t8;
a b v
1234567890 2 2009-02-14 00:31:30
drop table t1, t5, t6, t7, t8;

View File

@@ -0,0 +1,58 @@
#
# MDEV-7113 difference between check_vcol_func_processor and check_partition_func_processor
#
# the following functions must not be supported in virtual columns.
# but for compatibility reasons it won't be done in a GA version,
# we'll only fix most critical issues (inconsistent results, crashes)
connect (con1, localhost, root);
set lc_time_names = 'es_MX';
set time_zone='+10:00';
set div_precision_increment=20;
create table t1 (a int, b int, v decimal(20,19) as (a/3));
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
create table t2 (a int, b int, v int as (a+@a));
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
create table t3 (a int, b int, v int as (a+@@error_count));
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
create table t4 (a int, b int, v int as (@a:=a));
create table t5 (a int, b int, v varchar(100) as (monthname(a)));
create table t6 (a int, b int, v varchar(100) as (dayname(a)));
create table t7 (a int, b int, v varchar(100) as (date_format(a, '%W %a %M %b')));
create table t8 (a int, b int, v varchar(100) as (from_unixtime(a)));
insert t1 (a,b) values (1,2);
insert t5 (a,b) values (20141010,2);
insert t6 (a,b) values (20141010,2);
insert t7 (a,b) values (20141010,2);
insert t8 (a,b) values (1234567890,2);
select * from t1;
select * from t5;
select * from t6;
select * from t7;
select * from t8;
disconnect con1;
connection default;
set time_zone='+1:00';
select * from t1;
select * from t5;
select * from t6;
select * from t7;
select * from t8;
flush tables;
select * from t1;
select * from t5;
select * from t6;
select * from t7;
select * from t8;
drop table t1, t5, t6, t7, t8;

View File

@@ -2021,3 +2021,35 @@ connection default;
select * from t1;
unlock tables;
drop table t1,t2;
--echo #
--echo # MDEV-6179: dynamic columns functions/cast()/convert() doesn't
--echo # play nice with CREATE/ALTER TABLE
--echo #
create table t1 (
color char(32) as (COLUMN_GET(dynamic_cols, 1 as char)) persistent,
cl char(32) as (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) persistent,
item_name varchar(32) primary key, -- A common attribute for all items
i int,
dynamic_cols blob -- Dynamic columns will be stored here
);
INSERT INTO t1(item_name, dynamic_cols, i) VALUES
('MariaDB T-shirt', COLUMN_CREATE(1, 'blue', 2, 'XL'), 1);
INSERT INTO t1(item_name, dynamic_cols, i) VALUES
('Thinkpad Laptop', COLUMN_CREATE(1, 'black', 3, 500), 2);
select item_name, color, cl from t1;
show create table t1;
drop table t1;
create table t1 (
n int,
c char(32) as (convert(cast(n as char), char)) persistent
);
insert into t1(n) values (1),(2),(3);
select * from t1;
show create table t1;
drop table t1;

View File

@@ -786,6 +786,12 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
## TODO: add tests for all engines
#
--echo #
--echo # MDEV-6865 Merge Bug#18935421 RPAD DIES WITH CERTAIN PADSTR INTPUTS..
--echo #
DO RPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
--echo #
--echo # End of 5.5 tests
--echo #

View File

@@ -1,6 +1,7 @@
# Initialize
--disable_warnings
drop table if exists t1,t2,t3;
drop table if exists t0,t1,t2,t3;
drop database if exists test1;
--enable_warnings
set @exit_optimizer_switch=@@optimizer_switch;
@@ -272,5 +273,95 @@ limit 10;
drop table t1, t2, t3, t4;
--echo #
--echo # MDEV-6888: Query spends a long time in best_extension_by_limited_search with mrr enabled
--echo #
create database test1;
use test1;
set @tmp_jcl= @@join_cache_level;
set @tmp_os= @@optimizer_switch;
set join_cache_level=8;
set optimizer_switch='mrr=on,mrr_sort_keys=on';
CREATE TABLE t0 (
f1 bigint(20) DEFAULT NULL,
f2 char(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
INSERT INTO t0 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(1,'one'),(2,'two');
CREATE TABLE t1 (
f1 decimal(64,30) DEFAULT NULL,
f2 varchar(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES
(NULL,'numeric column is NULL'),
(0.000000000000000000000000000000,NULL),
(5.000000000000000000000000000000,'five'),
(1.000000000000000000000000000000,'one'),
(3.000000000000000000000000000000,'three');
CREATE TABLE t2 (
f1 double DEFAULT NULL,
f2 varbinary(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(2,'two'),(3,'three');
create VIEW v0 AS select f1,f2 from t1 ;
let $cnt= 27;
while ($cnt)
{
# i runs from 1 to 27
let $i= `select 28 - $cnt`;
let $prev=`select $i - 1`;
# rem = i mod 3
let $rem= `select MOD($i, 3)`;
# view uses $i, $prev and $rem:
eval create VIEW v$i AS select tab1_v$i.f1,tab1_v$i.f2 from t$rem tab1_v$i join v$prev tab2 on tab1_v$i.f1 = tab2.f1 and tab1_v$i.f2 = tab2.f2;
dec $cnt;
}
EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27;
--echo # This used to hang forever:
EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27;
use test;
drop database test1;
set join_cache_level=@tmp_jcl;
set optimizer_switch=@tmp_os;
--echo #
--echo # MDEV-6879: Dereference of NULL primary_file->table in DsMrr_impl::get_disk_sweep_mrr_cost()
--echo #
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int, b int, c text);
insert into t2
select
A.a + B.a* 10,
A.a + B.a* 10,
'blob-data'
from t1 A, t1 B;
set @tmp_jcl= @@join_cache_level;
set @tmp_os= @@optimizer_switch;
set join_cache_level=6;
set @@optimizer_switch='derived_merge=on,derived_with_keys=on,mrr=on';
explain
select * from
t1 join
(select * from t2 order by a limit 1000) as D1
where
D1.a= t1.a;
set join_cache_level=@tmp_jcl;
set optimizer_switch=@tmp_os;
drop table t1, t2;
# The following command must be the last one the file
set optimizer_switch=@exit_optimizer_switch;

View File

@@ -16,11 +16,17 @@ change_user $USER;
eval install plugin unix_socket soname '$AUTH_SOCKET_SO';
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT $USER USER
# Make sure that the replace works, even if $USER is 'user' or something else
# that matches other parts of the error message.
--echo connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET);
--let $replace=Access denied for user '$USER'
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT $replace "Access denied for user 'USER'"
--disable_query_log
--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
connect (fail,localhost,$USER);
--enable_query_log
--replace_result $USER USER
--replace_result $replace "Access denied for user 'USER'"
--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
change_user $USER;

View File

@@ -136,3 +136,12 @@ DROP TABLE t1;
--echo #
--echo # End of 5.3 tests
--echo #
#
# MDEV-4513 Valgrind warnings (Conditional jump or move depends on uninitialised value) in inflate on UNCOMPRESS
#
SELECT UNCOMPRESS(CAST(0 AS BINARY(5)));
--echo #
--echo # End of 5.5 tests
--echo #

View File

@@ -1561,3 +1561,21 @@ CREATE TABLE t1 ( d DATE, t TIME );
INSERT INTO t1 VALUES ('2008-12-05','22:34:09'),('2005-03-27','14:26:02');
SELECT EXTRACT(DAY_MINUTE FROM GREATEST(t,d)), GREATEST(t,d) FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-7221 from_days fails after null value
--echo #
CREATE TABLE t1 (
id INT(11) NOT NULL PRIMARY KEY,
date1 DATE NULL DEFAULT NULL
);
INSERT INTO t1 VALUES (12, '2011-05-12');
INSERT INTO t1 VALUES (13, NULL);
INSERT INTO t1 VALUES (14, '2009-10-23');
INSERT INTO t1 VALUES (15, '2014-10-30');
INSERT INTO t1 VALUES (16, NULL);
INSERT INTO t1 VALUES (17, NULL);
INSERT INTO t1 VALUES (18, '2010-10-13');
SELECT a.id,a.date1,FROM_DAYS(TO_DAYS(a.date1)-10) as date2, DATE_ADD(a.date1,INTERVAL -10 DAY),TO_DAYS(a.date1)-10 FROM t1 a ORDER BY a.id;
DROP TABLE t1;

View File

@@ -69,12 +69,15 @@ select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)')
select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45)')));
select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POINT(20 20)')));
select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200)')));
--replace_result 7.999999999999999 8
select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')));
--replace_result 7.999999999999999 8
select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')));
select astext(ST_intersection(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))')));
select astext(ST_symdifference(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))')));
--replace_result 7.999999999999999 8
select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')));
# Buffer() tests
@@ -83,13 +86,13 @@ select astext(ST_buffer(geometryfromtext('point(1 1)'), 1));
create table t1(geom geometrycollection);
insert into t1 values (geomfromtext('POLYGON((0 0, 10 10, 0 8, 0 0))'));
insert into t1 values (geomfromtext('POLYGON((1 1, 10 10, 0 8, 1 1))'));
select astext(geom), area(geom),area(ST_buffer(geom,2)) from t1;
select astext(ST_buffer(geom,2)) from t1;
select astext(geom), area(geom),round(area(ST_buffer(geom,2)), 7) from t1;
select ST_NUMPOINTS(ST_EXTERIORRING(ST_buffer(geom,2))) from t1;
set @geom=geomfromtext('LINESTRING(2 1, 4 2, 2 3, 2 5)');
set @buff=ST_buffer(@geom,1);
--replace_result 40278744502097 40278744502096
select astext(@buff);
select ST_NUMPOINTS(ST_EXTERIORRING(@buff));
# cleanup
DROP TABLE t1;
@@ -135,11 +138,10 @@ SELECT ASTEXT(ST_INTERSECTION(
#bug 804324 Assertion 0 in Gcalc_scan_iterator::pop_suitable_intersection
--replace_result 61538461538462 61538461538461
SELECT ASTEXT(ST_UNION(
SELECT ROUND(ST_LENGTH(ST_UNION(
MULTILINESTRINGFROMTEXT('MULTILINESTRING((6 2,4 0,3 5,3 6,4 3,6 4,3 9,0 7,3 7,8 4,2 9,5 0),
(8 2,1 3,9 0,4 4))'),
MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 5,6 7,9 7,5 2,1 6,3 6))')));
MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 5,6 7,9 7,5 2,1 6,3 6))'))), 7);
SELECT ST_NUMGEOMETRIES((ST_UNION(ST_UNION(
MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 0,4 2,0 2,1 5,0 3,7 0,8 5,5 8),
@@ -219,6 +221,7 @@ SELECT AsText(ST_UNION(POLYGONFROMTEXT('POLYGON((12 9, 3 6, 3 0, 12 9))'), POLYG
#bug 841622 Assertion `t->rp->type == Gcalc_function::shape_line' failed in Gcalc_operation_reducer::end_line in maria-5.3-gis
--replace_result 276 278
SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER(ST_UNION(
MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 4, 2 5, 7 6, 1 8),(0 0 ,1 6 ,0 1, 8 9, 2 4, 6 1, 3 5, 4 8), (9 3, 5 4, 1 8, 4 2, 5 8, 3 0))' ) ,
MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 4, 3 1, 2 7, 4 2, 6 2, 1 5))')
@@ -313,8 +316,8 @@ SELECT ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') ,
SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') );
#bug 977201 ST_BUFFER fails with the negative D
select ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3));
#bug 977201 ST_BUFFER fails with the negative D. TODO - check the result deeper.
# select ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3));
#bug 986977 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int)
SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0,

View File

@@ -1401,6 +1401,11 @@ insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
select equals(`a`,convert(`a` using utf8)) from `t1`;
drop table t1;
--echo #
--echo # MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0))
--echo #
select st_within(GeomFromText('Polygon((0 0))'), Point(0,0));
--echo End of 5.3 tests
--echo #

View File

@@ -1651,6 +1651,35 @@ SET sql_mode='ONLY_FULL_GROUP_BY';
SELECT 1 AS test UNION SELECT 2 AS test ORDER BY test IS NULL ASC;
SET sql_mode='';
--echo #
--echo # MDEV-6484: Assertion `tab->ref.use_count' failed on query with joins, constant table, multi-part key
--echo #
CREATE TABLE t1 (i1 INT, c1 VARCHAR(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (6,'b');
CREATE TABLE t2 (pk2 INT, i2 INT, c2 VARCHAR(1), PRIMARY KEY(pk2), KEY(pk2,i2)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,2,'s'),(2,4,'r'),(3,8,'m'),(4,4,'b'),(5,4,'x'),(6,7,'g'),(7,4,'p');
SELECT i2 FROM t1 AS t1a STRAIGHT_JOIN ( t2 INNER JOIN t1 AS t1b ON (t1b.c1 = c2) ) ON (t1b.i1 = pk2 )
WHERE t1a.c1 = c2 GROUP BY i2;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-6855
--echo # MIN(*) with subqueries with IS NOT NULL in WHERE clause crashed.
--echo #
CREATE TABLE t1 (i INT, c VARCHAR(3), KEY(c,i)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (7,'foo'),(0,'bar');
CREATE TABLE t2 (j INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (0),(8),(1),(8),(9);
SELECT MAX(i), c FROM t1
WHERE c != 'qux' AND ( SELECT SUM(j) FROM t1, t2 ) IS NOT NULL GROUP BY c;
drop table t1,t2;
#
# End of MariaDB 5.5 tests
#

View File

@@ -1298,12 +1298,16 @@ info='select * from information_schema.tables where 1=sleep(100000)';
disable_query_log;
eval kill $ID;
enable_query_log;
disconnect conn1;
let $wait_timeout= 10;
let $wait_condition=select count(*)=0 from information_schema.processlist
where state='User sleep' and
info='select * from information_schema.tables where 1=sleep(100000)';
--source include/wait_condition.inc
connection conn1;
--error 2013,ER_CONNECTION_KILLED
reap;
connection default;
disconnect conn1;
connect (conn1, localhost, root,,);
connection conn1;
@@ -1318,12 +1322,16 @@ info='select * from information_schema.columns where 1=sleep(100000)';
disable_query_log;
eval kill $ID;
enable_query_log;
disconnect conn1;
let $wait_timeout= 10;
let $wait_condition=select count(*)=0 from information_schema.processlist
where state='User sleep' and
info='select * from information_schema.columns where 1=sleep(100000)';
--source include/wait_condition.inc
connection conn1;
--error 2013,ER_CONNECTION_KILLED
reap;
connection default;
disconnect conn1;
#

View File

@@ -134,11 +134,39 @@ set optimizer_switch='index_condition_pushdown=on';
drop table t1,t2;
set @@join_cache_level= @save_join_cache_level;
set storage_engine=@save_storage_engine;
set optimizer_switch=@innodb_mrr_cpk_tmp;
drop table t0;
--echo #
--echo # MDEV-6878: Use of uninitialized saved_primary_key in Mrr_ordered_index_reader::resume_read()
--echo #
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (
pk varchar(32) character set utf8 primary key,
kp1 char(32) not null,
col1 varchar(32),
key (kp1)
) engine=innodb;
insert into t1
select
concat('pk-', 1000 +A.a),
concat('kp1-', 1000 +A.a),
concat('val-', 1000 +A.a)
from test.t0 A ;
create table t2 as select kp1 as a from t1;
set join_cache_level=8;
set optimizer_switch='mrr=on,mrr_sort_keys=on';
explain
select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a;
select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a;
drop table t0,t1,t2;
--echo #
--echo #
--echo # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions
--echo #
@@ -190,5 +218,13 @@ set join_cache_level=3;
explain SELECT 1 FROM (SELECT url, id FROM t2 LIMIT 1 OFFSET 20) derived RIGHT JOIN t1 ON t1.id = derived.id;
set join_cache_level= @tmp_mdev5037;
drop table t0,t1,t2;
--echo #
--echo # This must be at the end:
--echo #
set @@join_cache_level= @save_join_cache_level;
set storage_engine=@save_storage_engine;
set optimizer_switch=@innodb_mrr_cpk_tmp;

View File

@@ -1777,4 +1777,28 @@ SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON i2 = i3 ON i1 = i3
DROP TABLE t1,t2,t3;
--echo #
--echo # Bug mdev-6705: wrong on expression after constant row substitution
--echo # that triggers a simplification of WHERE condition
--echo #
CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (10,8);
CREATE TABLE t2 (c int) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8),(9);
CREATE TABLE t3 (d int) ENGINE=MyISAM;
INSERT INTO t3 VALUES (3),(8);
EXPLAIN EXTENDED
SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
WHERE b IN (1,2,3) OR b = d;
SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
WHERE b IN (1,2,3) OR b = d;
DROP TABLE t1,t2,t3;
SET optimizer_switch=@save_optimizer_switch;

View File

@@ -0,0 +1 @@
--skip-name-resolve

29
mysql-test/t/kill-2.test Normal file
View File

@@ -0,0 +1,29 @@
#
# Test KILL and KILL QUERY statements.
#
# Killing a connection in an embedded server does not work like in a normal
# server, if it is waiting for a new statement. In an embedded server, the
# connection does not read() from a socket, but returns control to the
# application. 'mysqltest' does not handle the kill request.
#
-- source include/not_embedded.inc
-- source include/not_threadpool.inc
--echo #
--echo # MDEV-6896 kill user command cause MariaDB crash!
--echo #
create user foo@'127.0.0.1';
--connect (con1,127.0.0.1,foo,,)
--connection default
select user from information_schema.processlist;
kill user foo@'127.0.0.1';
let $wait_condition=
select count(*) = 0 from information_schema.processlist
where user = "foo";
--source include/wait_condition.inc
drop user foo@'127.0.0.1';

View File

@@ -30,7 +30,11 @@ while ($1)
--enable_query_log
--connect(con1,localhost,root,,)
SET debug_sync= 'myisam_after_repair_by_sort SIGNAL waiting WAIT_FOR go';
# Set a debug_sync waitpoint.
# This is just to ensure that the ALTER does not have time to complete
# its operation and change the status away from "Repair by sorting" before
# wait_condition has a chance to see it.
SET debug_sync= 'myisam_after_repair_by_sort WAIT_FOR go';
send
ALTER TABLE t1 ENABLE KEYS;
@@ -38,9 +42,10 @@ send
--let $wait_timeout=60
--let $show_statement= SHOW PROCESSLIST
--let $field= State
--let $condition= = 'Repair by sorting'
# If the sort completes early and we hit the debug_sync point, the processlist
# will show the debug_sync state, so we need to check for that also.
--let $condition= RLIKE 'Repair by sorting|myisam_after_repair_by_sort'
--source include/wait_show_condition.inc
SET debug_sync= 'now WAIT_FOR waiting';
SET debug_sync= 'now SIGNAL go';
--replace_column 7 # 8 # 9 # 12 # 13 # 14 #

View File

@@ -20,13 +20,16 @@ grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA
grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx";
flush privileges;
connect (con1,localhost,ssl_user1,,,,,SSL);
connect (con2,localhost,ssl_user2,,,,,SSL);
connect (con3,localhost,ssl_user3,,,,,SSL);
connect (con4,localhost,ssl_user4,,,,,SSL);
connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_ACCESS_DENIED_ERROR
connect (con5,localhost,ssl_user5,,,,,SSL);
connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=RC4-SHA);
connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA);
connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA);
connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_ACCESS_DENIED_ERROR
connect (con5,localhost,ssl_user5,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA);
connection con1;
# Check ssl turned on
@@ -129,6 +132,7 @@ drop table t1;
# verification of servers certificate by setting both ca certificate
# and ca path to NULL
#
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1
--echo End of 5.0 tests
@@ -255,6 +259,7 @@ select 'is still running; no cipher request crashed the server' as result from d
GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509;
FLUSH PRIVILEGES;
connect(con1,localhost,bug42158,,,,,SSL);
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
disconnect con1;
connection default;

View File

@@ -0,0 +1,6 @@
[tlsv12]
loose-ssl-cipher=TLSv1.2
[tlsv10]
loose-ssl-cipher=SSLv3

View File

@@ -0,0 +1,38 @@
#
# MDEV-6975 Implement TLS protocol
#
# test SSLv3 and TLSv1.2 ciphers when OpenSSL is restricted to SSLv3 or TLSv1.2
#
source include/have_ssl_communication.inc;
# this is OpenSSL test.
grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA";
grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256";
let $mysql=$MYSQL --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1;
disable_abort_on_error;
echo TLS1.2 ciphers: user is ok with any cipher;
exec $mysql --ssl-cipher=AES128-SHA256;
exec $mysql --ssl-cipher=TLSv1.2;
echo TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA;
exec $mysql --user ssl_sslv3 --ssl-cipher=AES128-SHA256;
exec $mysql --user ssl_sslv3 --ssl-cipher=TLSv1.2;
echo TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256;
exec $mysql --user ssl_tls12 --ssl-cipher=AES128-SHA256;
exec $mysql --user ssl_tls12 --ssl-cipher=TLSv1.2;
echo SSLv3 ciphers: user is ok with any cipher;
exec $mysql --ssl-cipher=RC4-SHA;
exec $mysql --ssl-cipher=SSLv3;
echo SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA;
exec $mysql --user ssl_sslv3 --ssl-cipher=RC4-SHA;
exec $mysql --user ssl_sslv3 --ssl-cipher=SSLv3;
echo SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256;
exec $mysql --user ssl_tls12 --ssl-cipher=RC4-SHA;
exec $mysql --user ssl_tls12 --ssl-cipher=SSLv3;
drop user ssl_sslv3@localhost;
drop user ssl_tls12@localhost;

View File

@@ -2005,3 +2005,14 @@ PARTITION pmax VALUES LESS THAN MAXVALUE);
DROP TABLE t1;
--echo End of 5.1 tests
#
# MDEV-7113 difference between check_vcol_func_processor and check_partition_func_processor
#
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
create table t1 (a int) partition by list (values(a) div 1) (partition p0 values in (0), partition p1 values in (1));
--error ER_PARSE_ERROR
create table t1 (a int) partition by list (uuid_short()) (partition p0 values in (0), partition p1 values in (1));
--echo End of 5.5 tests

View File

@@ -4,19 +4,22 @@
source include/have_debug_sync.inc;
let $tid= `SELECT CONNECTION_ID()`;
SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time';
send SELECT 1;
connect (con1,localhost,root,,);
SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed';
send SELECT INFO,TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO IS NULL;
--replace_result $tid TID
send_eval SELECT ID, TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE CONCAT(":", ID, ":") = ":$tid:";
connection default;
reap;
SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
connection con1;
--replace_result $tid TID
reap;
connection default;
@@ -24,10 +27,24 @@ connection default;
# MDEV-4683 query start_time not reset when going to sleep
#
connection con1;
# Trigger a signal once the thread has gone from "Query" to "Sleep" command
# state. Note we need to execute this twice: Once at the end of SET DEBUG_SYNC,
# and once for the intended time, at the end of SELECT SLEEP().
SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done EXECUTE 2';
connection default;
# Wait for and clear the first signal set during SET DEBUG_SYNC.
SET DEBUG_SYNC= 'now WAIT_FOR query_done';
SET DEBUG_SYNC= 'now SIGNAL nosignal';
connection con1;
select sleep(5); #run a query that will take some time
connection default;
# Need to ensure that the previous query has really completed. Otherwise,
# the select could see the previous query still in "Query" stage in the
# processlist.
SET DEBUG_SYNC = 'now WAIT_FOR query_done';
# verify that the time in COM_SLEEP doesn't include the query run time
select command, time < 5 from information_schema.processlist where id != connection_id();

View File

@@ -11,12 +11,14 @@
connect (ssl_con,localhost,root,,,,,SSL);
# Check ssl turned on
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
# Source select test case
-- source include/common-tests.inc
# Check ssl turned on
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
connection default;

View File

@@ -1 +1,3 @@
--loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem --loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem
--loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem
--loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem
--loose-ssl-cipher=DHE-RSA-AES256-SHA

View File

@@ -11,6 +11,7 @@
connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
# Check ssl turned on
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on
@@ -20,6 +21,7 @@ SHOW STATUS LIKE 'Compression';
-- source include/common-tests.inc
# Check ssl turned on
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on

View File

@@ -1330,3 +1330,23 @@ create table t1 (a int);
insert t1 values (1),(2),(3),(1);
explain select 1 from dual where exists (select max(a) from t1 group by a union select a+2 from t1);
drop table t1;
--echo #
--echo # MDEV-6868:MariaDB server crash ( select with union and order by
--echo # with subquery )
--echo #
CREATE TABLE t1 ( id INTEGER, sample_name1 VARCHAR(100), sample_name2 VARCHAR(100), PRIMARY KEY(id) );
INSERT INTO t1 ( id, sample_name1, sample_name2 ) VALUES ( 1, 'aaaa', 'bbbb' ), ( 2, 'cccc', 'dddd' );
(
SELECT sample_name1 AS testname FROM t1
)
UNION
(
SELECT sample_name2 AS testname FROM t1 C ORDER BY (SELECT T.sample_name1 FROM t1 T WHERE T.id = C.id)
)
;
drop table t1;