Commit c90ffae0 authored by Otto Kekäläinen's avatar Otto Kekäläinen
Browse files

Update upstream source from tag 'upstream/10.1.39'

Update to upstream version '10.1.39'
with Debian dir b02cce09df65b5e8c30006c7cfbae4ad19f48522
parents 81524620 7e54c6cf
drop table if exists t1, t2;
create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null); create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null);
insert into t1 values (1,1,"a","a"); insert into t1 values (1,1,"a","a");
insert into t1 values (2,2,"b","a"); insert into t1 values (2,2,"b","a");
...@@ -1200,3 +1199,30 @@ Warning 1260 Row 3 was cut by GROUP_CONCAT() ...@@ -1200,3 +1199,30 @@ Warning 1260 Row 3 was cut by GROUP_CONCAT()
Warning 1260 Row 5 was cut by GROUP_CONCAT() Warning 1260 Row 5 was cut by GROUP_CONCAT()
DROP TABLE t1; DROP TABLE t1;
SET group_concat_max_len= DEFAULT; SET group_concat_max_len= DEFAULT;
set max_session_mem_used=16*1024*1024;
SELECT GROUP_CONCAT(concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1) ORDER BY 2,1,3,4,6,5,8,7) AS c
FROM seq_1_to_200000;
c
0.90910.90910.90910.90910.90910.90910.90910.9091,1.81821.81821.81821.81821.81821.81821.81821.8182,10.000010.000010.000010.000010.000010.000010.000010.0000,10.909110.909110.909110.909110.909110.909110.909110.9091,100.0000100.0000100.0000100.0000100.0000100.0000100.0000100.0000,100.9091100.9091100.9091100.9091100.9091100.9091100.9091100.9091,1000.00001000.00001000.00001000.00001000.00001000.00001000.00001000.0000,1000.90911000.90911000.90911000.90911000.90911000.90911000.90911000.9091,10000.000010000.000010000.000010000.000010000.000010000.000010000.000010000.0000,10000.909110000.909110000.909110000.909110000.909110000.909110000.909110000.9091,100000.0000100000.0000100000.0000100000.0000100000.0000100000.0000100000.0000100000.0000,100000.9091100000.9091100000.9091100000.9091100000.9091100000.9091100000.9091100000.9091,100001.8182100001.8182100001.8182100001.8182100001.8182100001.8182100001.8182100001.8182,100002.7273100002.7273100002.7273100002.7273100002.7273100002.7273100002.7273100002.7273,100003.6364100003.
Warnings:
Warning 1260 Row 15 was cut by GROUP_CONCAT()
set max_session_mem_used=default;
SET group_concat_max_len= 8;
CREATE TABLE t1 (a INT);
INSERT t1 VALUES (1),(2);
CREATE TABLE t2 (b DATE, c INT);
INSERT t2 VALUES ('2019-12-04',1),('2020-03-28',2);
CREATE TABLE t3 (d INT);
INSERT t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14);
CREATE TABLE t4 (e INT);
INSERT t4 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15);
SELECT (SELECT MAX(a) FROM t1 WHERE t2_sq.c > 0) AS f,
GROUP_CONCAT(t2_sq.b ORDER BY 1) AS gc
FROM (SELECT t2_a.* FROM t2 AS t2_a, t2 AS t2_b) AS t2_sq, t3, t4
GROUP BY f;
f gc
2 2019-12-
Warnings:
Warning 1260 Row 1 was cut by GROUP_CONCAT()
DROP TABLE t1, t2, t3, t4;
SET group_concat_max_len= default;
...@@ -1979,8 +1979,8 @@ FROM t2); ...@@ -1979,8 +1979,8 @@ FROM t2);
MIN(t2.pk) MIN(t2.pk)
NULL NULL
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'j' Warning 1292 Truncated incorrect DOUBLE value: 'j'
Warning 1292 Truncated incorrect INTEGER value: 'j' Warning 1292 Truncated incorrect DOUBLE value: 'j'
EXPLAIN EXPLAIN
SELECT MIN(t2.pk) SELECT MIN(t2.pk)
...@@ -1993,8 +1993,8 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1993,8 +1993,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'j' Warning 1292 Truncated incorrect DOUBLE value: 'j'
Warning 1292 Truncated incorrect INTEGER value: 'j' Warning 1292 Truncated incorrect DOUBLE value: 'j'
# #
# 2) Test that subquery materialization is setup for query with # 2) Test that subquery materialization is setup for query with
......
...@@ -2179,10 +2179,10 @@ def if_______a_b 12 19 19 Y 128 0 63 ...@@ -2179,10 +2179,10 @@ def if_______a_b 12 19 19 Y 128 0 63
def if_______b_a 12 19 19 Y 128 0 63 def if_______b_a 12 19 19 Y 128 0 63
def ifnull___a_b 12 19 19 Y 128 0 63 def ifnull___a_b 12 19 19 Y 128 0 63
def ifnull___b_a 12 19 19 Y 128 0 63 def ifnull___b_a 12 19 19 Y 128 0 63
def least____a_b 12 10 19 Y 128 0 63 def least____a_b 12 19 19 Y 128 0 63
def least____b_a 12 10 19 Y 128 0 63 def least____b_a 12 19 19 Y 128 0 63
def greatest_a_b 12 10 19 Y 128 0 63 def greatest_a_b 12 19 19 Y 128 0 63
def greatest_b_a 12 10 19 Y 128 0 63 def greatest_b_a 12 19 19 Y 128 0 63
case_____a_b 2010-01-01 00:00:00 case_____a_b 2010-01-01 00:00:00
case_____b_a 2001-01-01 10:20:30 case_____b_a 2001-01-01 10:20:30
coalesce_a_b 2010-01-01 00:00:00 coalesce_a_b 2010-01-01 00:00:00
...@@ -3034,7 +3034,7 @@ DROP TABLE t1; ...@@ -3034,7 +3034,7 @@ DROP TABLE t1;
SET timestamp=UNIX_TIMESTAMP('2010-01-01 01:02:03'); SET timestamp=UNIX_TIMESTAMP('2010-01-01 01:02:03');
SELECT GREATEST(CURRENT_TIME, CURRENT_DATE), COALESCE(CURRENT_TIME, CURRENT_DATE); SELECT GREATEST(CURRENT_TIME, CURRENT_DATE), COALESCE(CURRENT_TIME, CURRENT_DATE);
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def GREATEST(CURRENT_TIME, CURRENT_DATE) 12 10 19 N 129 0 63 def GREATEST(CURRENT_TIME, CURRENT_DATE) 12 19 19 N 129 0 63
def COALESCE(CURRENT_TIME, CURRENT_DATE) 12 19 19 N 129 0 63 def COALESCE(CURRENT_TIME, CURRENT_DATE) 12 19 19 N 129 0 63
GREATEST(CURRENT_TIME, CURRENT_DATE) COALESCE(CURRENT_TIME, CURRENT_DATE) GREATEST(CURRENT_TIME, CURRENT_DATE) COALESCE(CURRENT_TIME, CURRENT_DATE)
2010-01-01 01:02:03 2010-01-01 01:02:03 2010-01-01 01:02:03 2010-01-01 01:02:03
...@@ -3427,5 +3427,35 @@ t1 CREATE TABLE `t1` ( ...@@ -3427,5 +3427,35 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-11015 Assertion failed: precision > 0 in decimal_bin_size upon SELECT with DISTINCT, CAST and other functions
#
CREATE TABLE t1 (b LONGBLOB);
INSERT IGNORE INTO t1 VALUES ('foo'),('bar');
SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATETIME ) ) AS f FROM t1;
f
NULL
Warnings:
Warning 1292 Incorrect datetime value: 'foo'
Warning 1292 Incorrect datetime value: 'bar'
DROP TABLE t1;
CREATE TABLE t1 (b LONGBLOB);
INSERT IGNORE INTO t1 VALUES ('foo'),('bar');
SELECT DISTINCT - GREATEST( b, CAST( NULL AS TIME) ) AS f FROM t1;
f
NULL
Warnings:
Warning 1292 Truncated incorrect time value: 'foo'
Warning 1292 Truncated incorrect time value: 'bar'
DROP TABLE t1;
CREATE TABLE t1 (b LONGBLOB);
INSERT IGNORE INTO t1 VALUES ('foo'),('bar');
SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATE) ) AS f FROM t1;
f
NULL
Warnings:
Warning 1292 Incorrect datetime value: 'foo'
Warning 1292 Incorrect datetime value: 'bar'
DROP TABLE t1;
#
# End of 10.1 tests # End of 10.1 tests
# #
...@@ -807,3 +807,46 @@ STDDEV_POP(ROUND(0,@A:=2009)) ...@@ -807,3 +807,46 @@ STDDEV_POP(ROUND(0,@A:=2009))
# #
# End of 10.0 tests # End of 10.0 tests
# #
#
# Start of 10.1 tests
#
#
# MDEV-17643 Assertion `nr >= 0.0' failed in Item_sum_std::val_real()
#
CREATE TABLE t1 ( pk int NOT NULL, i1 int NOT NULL, d1 date NOT NULL, t1 time);
INSERT INTO t1 VALUES (7,9,'2007-08-15','03:55:02'),(8,7,'1993-06-05','04:17:51'),(9,7,'2034-07-01','17:31:12'),(10,0,'1998-08-24','08:09:27');
SELECT DISTINCT STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1)))) FROM t1;
STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1))))
NULL
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'o'
Warning 1292 Truncated incorrect DOUBLE value: '98e466c7ff40fe6b95cde24200f376303-13797903358356357128e466c7ff40fe6b95cde24200f376303-13797903358356357128e466c7ff40fe6b95cde242'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
Warning 1292 Truncated incorrect DOUBLE value: '-1379790335835635712e315457d879863c6ccf2ddee5562fc24-1379790335835635712e315457d879863c6ccf2ddee5562fc24-1379790335835635712e315'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
Warning 1292 Truncated incorrect DOUBLE value: '7b4dd517b633f1f6304b773523b5279747b4dd517b633f1f6304b773523b5279747b4dd517b633f1f6304b773523b527974-1379790335835635712b4dd517b6'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
Warning 1292 Truncated incorrect DOUBLE value: '-1379790335835635712b0e107767ea830fd3318893e40412a43-1379790335835635712b0e107767ea830fd3318893e40412a43-1379790335835635712b0e1'
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(128));
INSERT INTO t1 VALUES ('1e310');
INSERT INTO t1 VALUES ('-1e310');
INSERT INTO t1 VALUES ('0');
SELECT STDDEV_SAMP(a) FROM t1;
STDDEV_SAMP(a)
NULL
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1e310'
Warning 1292 Truncated incorrect DOUBLE value: '-1e310'
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (1.7e+308);
INSERT INTO t1 VALUES (-1.7e+308);
INSERT INTO t1 VALUES (0);
SELECT STDDEV_SAMP(a) FROM t1;
STDDEV_SAMP(a)
NULL
DROP TABLE t1;
#
# End of 10.1 tests
#
...@@ -2980,6 +2980,49 @@ select md5(_filename "a"), sha(_filename "a"); ...@@ -2980,6 +2980,49 @@ select md5(_filename "a"), sha(_filename "a");
md5(_filename "a") sha(_filename "a") md5(_filename "a") sha(_filename "a")
0cc175b9c0f1b6a831c399e269772661 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 0cc175b9c0f1b6a831c399e269772661 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
# #
# MDEV-18881 Assertion `0' failed in make_sortkey upon SELECT with GROUP BY after LOAD DATA
#
CREATE TABLE t1 (a BIT(22), b CHAR(8) NOT NULL, c CHAR(8));
INSERT INTO t1 VALUES (0xA4B,'foo','qux');
INSERT INTO t1 VALUES (0x8F5,'bar','foobar');
INSERT INTO t1 VALUES (0x0, '', NULL);
INSERT INTO t1 VALUES (0x4B, 'foo','qux');
INSERT INTO t1 VALUES (0x8F5, 'bar', 'foobar');
SET SESSION SQL_MODE= '';
SELECT GROUP_CONCAT(c) AS f FROM t1 GROUP BY LPAD('foo', 20, b);
f
NULL
foobar,foobar
qux,qux
DROP TABLE t1;
SET SESSION SQL_MODE=DEFAULT;
CREATE TABLE t1 AS SELECT
LPAD('a',10,' '),
RPAD('a',10,' '),
LPAD('a',10,' '),
RPAD('a',10,' '),
LPAD('a',10,NULL),
RPAD('a',10,NULL),
LPAD('a',10,''),
RPAD('a',10,''),
LPAD('a',10,RAND()),
RPAD('a',10,RAND());
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`LPAD('a',10,' ')` varchar(10) NOT NULL,
`RPAD('a',10,' ')` varchar(10) NOT NULL,
`LPAD('a',10,' ')` varchar(10) NOT NULL,
`RPAD('a',10,' ')` varchar(10) NOT NULL,
`LPAD('a',10,NULL)` varchar(10) DEFAULT NULL,
`RPAD('a',10,NULL)` varchar(10) DEFAULT NULL,
`LPAD('a',10,'')` varchar(10) DEFAULT NULL,
`RPAD('a',10,'')` varchar(10) DEFAULT NULL,
`LPAD('a',10,RAND())` varchar(10) DEFAULT NULL,
`RPAD('a',10,RAND())` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# End of 5.5 tests # End of 5.5 tests
# #
# #
...@@ -4714,5 +4757,43 @@ YQ== 61 ...@@ -4714,5 +4757,43 @@ YQ== 61
Yq== 62 Yq== 62
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-18738 ASAN heap-use-after-free in copy_if_not_alloced / copy_fields
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
SELECT REPLACE( CAST( CURDATE() AS BINARY ), CURDATE(), REPEAT('a',32) ) AS f FROM t1 GROUP BY f;
f
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
SELECT REPLACE( LEFT( CURDATE(), 4), LEFT(CURDATE(),4), REPEAT('a',32) ) AS f FROM t1 GROUP BY f;
f
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
SELECT REPLACE(RIGHT(CURDATE(), 4), RIGHT(CURDATE(),4), REPEAT('a',32)) AS f FROM t1 GROUP BY f;
f
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
SELECT REPLACE(SUBSTR(CURDATE(),2,3), SUBSTR(CURDATE(),2,3), REPEAT('a',32)) AS f FROM t1 GROUP BY f;
f
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DROP TABLE t1;
#
# MDEV-19359 ASAN heap-use-after-free in copy_if_not_alloced / make_sortkey
#
CREATE TABLE t1 (a INT, b TIME, c TIME);
INSERT INTO t1 VALUES (NULL,'22:56:45','22:56:45'),(4,'12:51:42','12:51:42');
SELECT REPLACE( BINARY c, a, b ) f FROM t1 GROUP BY f WITH ROLLUP;
f
NULL
12:51:12:51:422
NULL
DROP TABLE t1;
#
# End of 10.1 tests # End of 10.1 tests
# #
...@@ -3420,5 +3420,35 @@ t2 CREATE TABLE `t2` ( ...@@ -3420,5 +3420,35 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# MDEV-14926 AddressSanitizer: heap-use-after-free in make_date_time on weird combination of functions
#
DO INET_ATON( FROM_UNIXTIME( @@timestamp, ( TRIM( UNHEX(HEX('%m.%d.%Y') ) ) ) ) );
CREATE TABLE t1 (d DATE);
INSERT INTO t1 VALUES ('1989-03-10');
SELECT TIME_FORMAT('23:59:43', BINARY d) AS f FROM t1 GROUP BY 'foo';
f
1989-03-10
DROP TABLE t1;
CREATE TABLE t1 (d DATE) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('1900-01-01');
SELECT LENGTH( DATE_FORMAT( d, BINARY DATABASE() ) ) AS f FROM t1 GROUP BY d;
f
4
DROP TABLE t1;
#
# MDEV-18667 ASAN heap-use-after-free in make_date_time / Arg_comparator::compare_string / Item_func_nullif::compare
#
SELECT NULLIF('foo', FROM_UNIXTIME('2012-12-12 12:12:12', TRIM(0)));
NULLIF('foo', FROM_UNIXTIME('2012-12-12 12:12:12', TRIM(0)))
foo
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2012-12-12 12:12:12'
#
# MDEV-18626 ASAN stack-buffer-overflow in int10_to_str / make_date_time upon DATE_FORMAT
#
SELECT DATE_FORMAT(100000000000, '%j');
DATE_FORMAT(100000000000, '%j')
NULL
#
# End of 10.1 tests # End of 10.1 tests
# #
...@@ -505,6 +505,10 @@ GEOMETRYFROMTEXT('POINT(4599 60359)'), ...@@ -505,6 +505,10 @@ GEOMETRYFROMTEXT('POINT(4599 60359)'),
) as relate_res; ) as relate_res;
relate_res relate_res
0 0
prepare s from 'do st_convexhull(st_aswkb(multipoint(point(-11702,15179),point(-5031,27960),point(-30557,11158),point(-27804,30314))))';
execute s;
execute s;
deallocate prepare s;
DROP TABLE IF EXISTS p1; DROP TABLE IF EXISTS p1;
CREATE PROCEDURE p1(dist DOUBLE, geom TEXT) CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
BEGIN BEGIN
......
...@@ -1877,3 +1877,17 @@ t2 CREATE TABLE `t2` ( ...@@ -1877,3 +1877,17 @@ t2 CREATE TABLE `t2` (
`w2` int(1) DEFAULT NULL `w2` int(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
point_data POINT NOT NULL,
PRIMARY KEY (id),
KEY idx_point_data(point_data)
) ENGINE=MyISAM;
INSERT t1 (point_data) VALUES
(GeomFromText('Point(37.0248492 23.8512726)')),
(GeomFromText('Point(38.0248492 23.8512726)'));
SELECT id FROM t1
WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
id
2
DROP TABLE t1;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
point_data POINT NOT NULL,
PRIMARY KEY (id),
KEY idx_point_data(point_data)
) ENGINE=MyISAM;
INSERT t1 (point_data) VALUES
(GeomFromText('Point(37.0248492 23.8512726)')),
(GeomFromText('Point(38.0248492 23.8512726)'));
SELECT id FROM t1
WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
id
2
DROP TABLE t1;
show create procedure mysql.AddGeometryColumn;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
AddGeometryColumn CREATE DEFINER=`root`@`localhost` PROCEDURE `AddGeometryColumn`(catalog varchar(64), t_schema varchar(64),
t_name varchar(64), geometry_column varchar(64), t_srid int)
SQL SECURITY INVOKER
begin
set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end latin1 latin1_swedish_ci latin1_swedish_ci
show create procedure mysql.DropGeometryColumn;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
DropGeometryColumn CREATE DEFINER=`root`@`localhost` PROCEDURE `DropGeometryColumn`(catalog varchar(64), t_schema varchar(64),
t_name varchar(64), geometry_column varchar(64))
SQL SECURITY INVOKER
begin
set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end latin1 latin1_swedish_ci latin1_swedish_ci
create table t1 (a int, b int);
call mysql.AddGeometryColumn('', 'test', 't1', 'c', 10);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
`c` geometry DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
call mysql.DropGeometryColumn('', 'test', 't1', 'c');
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
call mysql.DropGeometryColumn('', 'test', 't1', 'b');
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create user foo@localhost;
grant execute on mysql.* to foo@localhost;
call mysql.AddGeometryColumn('', 'mysql', 'proc', 'c', 10);
ERROR 42000: ALTER command denied to user 'foo'@'localhost' for table 'proc'
drop user foo@localhost;
...@@ -123,6 +123,26 @@ View Create View character_set_client collation_connection ...@@ -123,6 +123,26 @@ View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t_select_priv`.`a` AS `a`,`t_select_priv`.`b` AS `b` from `t_select_priv` latin1 latin1_swedish_ci v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t_select_priv`.`a` AS `a`,`t_select_priv`.`b` AS `b` from `t_select_priv` latin1 latin1_swedish_ci
drop database mysqltest_db1; drop database mysqltest_db1;
drop user mysqltest_u1@localhost; drop user mysqltest_u1@localhost;
call mtr.add_suppression("Table 'mysql.user' doesn't exist");
call mtr.add_suppression("'mysql.user' is not TABLE");
rename table mysql.user to mysql.user1;
create view mysql.user as select * from mysql.user1;
flush privileges;
ERROR HY000: 'mysql.user' is not TABLE
drop view mysql.user;
create temporary table mysql.user select * from mysql.user1 limit 0;
flush privileges;
ERROR 42S02: Table 'mysql.user' doesn't exist
drop temporary table mysql.user;
rename table mysql.user1 to mysql.user;
call mtr.add_suppression('mysql.user table is damaged');
rename table mysql.user to mysql.user1;
create table mysql.user (Host char(100), User char(100));
flush privileges;
ERROR HY000: Unknown error
drop table mysql.user;
rename table mysql.user1 to mysql.user;
End of 5.5 tests
# #
# Additional coverage for refactoring which is made as part # Additional coverage for refactoring which is made as part
# of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege # of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege
...@@ -215,3 +235,4 @@ ERROR HY000: Password hash should be a 16-digit hexadecimal number ...@@ -215,3 +235,4 @@ ERROR HY000: Password hash should be a 16-digit hexadecimal number
create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111'; create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111';
ERROR HY000: Password hash should be a 16-digit hexadecimal number ERROR HY000: Password hash should be a 16-digit hexadecimal number
set GLOBAL sql_mode=default; set GLOBAL sql_mode=default;
End of 10.1 tests
...@@ -294,6 +294,7 @@ key3 int not null default 0 ...@@ -294,6 +294,7 @@ key3 int not null default 0
); );
insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8); insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8);
set @d=8; set @d=8;
begin;
insert into t1 (key1) select key1+@d from t1; insert into t1 (key1) select key1+@d from t1;
set @d=@d*2; set @d=@d*2;
insert into t1 (key1) select key1+@d from t1; insert into t1 (key1) select key1+@d from t1;
...@@ -308,9 +309,11 @@ insert into t1 (key1) select key1+@d from t1; ...@@ -308,9 +309,11 @@ insert into t1 (key1) select key1+@d from t1;
set @d=@d*2; set @d=@d*2;
insert into t1 (key1) select key1+@d from t1; insert into t1 (key1) select key1+@d from t1;
set @d=@d*2; set @d=@d*2;
commit;
alter table t1 add index i2(key2); alter table t1 add index i2(key2);
alter table t1 add index i3(key3); alter table t1 add index i3(key3);
update t1 set key2=key1,key3=key1; update t1 set key2=key1,key3=key1;
insert into t1 select 10000+key1, 10000+key2,10000+key3 from t1;
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
...@@ -672,6 +675,7 @@ a int, ...@@ -672,6 +675,7 @@ a int,
b int, b int,
INDEX idx(a)) INDEX idx(a))
ENGINE=INNODB; ENGINE=INNODB;
begin;
INSERT INTO t1(a,b) VALUES INSERT INTO t1(a,b) VALUES
(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500), (11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800), (3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
...@@ -691,6 +695,7 @@ INSERT INTO t1(a,b) SELECT a,b FROM t1; ...@@ -691,6 +695,7 @@ INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1; INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1; INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1 VALUES (1000000, 0, 0); INSERT INTO t1 VALUES (1000000, 0, 0);
commit;
SET SESSION sort_buffer_size = 1024*36; SET SESSION sort_buffer_size = 1024*36;
set @tmp_optimizer_switch=@@optimizer_switch; set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off'; set optimizer_switch='derived_merge=off,derived_with_keys=off';
......
...@@ -1129,6 +1129,7 @@ key3 int not null default 0 ...@@ -1129,6 +1129,7 @@ key3 int not null default 0
); );
insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8); insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8);
set @d=8; set @d=8;
begin;
insert into t1 (key1) select key1+@d from t1; insert into t1 (key1) select key1+@d from t1;
set @d=@d*2; set @d=@d*2;
insert into t1 (key1) select key1+@d from t1; insert into t1 (key1) select key1+@d from t1;
...@@ -1143,9 +1144,11 @@ insert into t1 (key1) select key1+@d from t1; ...@@ -1143,9 +1144,11 @@ insert into t1 (key1) select key1+@d from t1;
set @d=@d*2; set @d=@d*2;
insert into t1 (key1) select key1+@d from t1; insert into t1 (key1) select key1+@d from t1;
set @d=@d*2; set @d=@d*2;
commit;
alter table t1 add index i2(key2); alter table t1 add index i2(key2);
alter table t1 add index i3(key3); alter table t1 add index i3(key3);
update t1 set key2=key1,key3=key1; update t1 set key2=key1,key3=key1;
insert into t1 select 10000+key1, 10000+key2,10000+key3 from t1;
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
......
PREPARE stmt2 FROM "CREATE VIEW v AS SELECT * FROM INFORMATION_SCHEMA.TABLES";
FLUSH PRIVILEGES;
EXECUTE stmt2;
DROP VIEW v;
...@@ -574,3 +574,53 @@ SELECT HEX(a) FROM t1; ...@@ -574,3 +574,53 @@ SELECT HEX(a) FROM t1;
HEX(a) HEX(a)
C3A4 C3A4
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-15744: Assertion `derived->table' failed in mysql_derived_merge_for_insert
#
create table t1 (a int, b int);
CREATE OR REPLACE VIEW t2 AS SELECT * FROM t1;
CREATE VIEW v2 AS SELECT * FROM t2;
LOAD DATA INFILE '../../std_data/loaddata7.dat' INTO TABLE v2
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n';
select * from v2;
a b
2 2
3 3
4 4
5 5
6 6
select * from t2;
a b
2 2
3 3
4 4
5 5
6 6
DROP VIEW IF EXISTS v2,t2;
DROP TABLE IF EXISTS t1;
#
# MDEV-15950: LOAD DATA INTO compex_view crashed
#
create table t1 (a int, b int);
create table t0 (x int, y int);
CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1,t0;
CREATE VIEW v2 AS SELECT * FROM v1;
LOAD DATA INFILE '../../std_data/loaddata7.dat' INTO TABLE v1
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n';
ERROR HY000: Incorrect usage of Multi-table VIEW and LOAD
LOAD DATA INFILE '../../std_data/loaddata7.dat' INTO TABLE v2
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n';
ERROR HY000: Incorrect usage of Multi-table VIEW and LOAD
DROP VIEW IF EXISTS v2,v1;
DROP TABLE IF EXISTS t1,t0;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), UNIQUE(b));
INSERT INTO t1 VALUES (1,1);
CREATE TABLE t2 (c INT);
CREATE VIEW v AS SELECT t1.* FROM t1 JOIN t2;
SELECT a, b FROM t1 INTO OUTFILE '15645.data';
LOAD DATA INFILE '15645.data' IGNORE INTO TABLE v (a,b);
ERROR HY000: Incorrect usage of Multi-table VIEW and LOAD
LOAD DATA INFILE '15645.data' REPLACE INTO TABLE v (a,b);
ERROR HY000: Incorrect usage of Multi-table VIEW and LOAD
drop table t1,t2;
drop view v;
...@@ -725,7 +725,11 @@ DROP TABLE t1, t2; ...@@ -725,7 +725,11 @@ DROP TABLE t1, t2;
# Bug#51391 Deadlock involving events during rqg_info_schema test # Bug#51391 Deadlock involving events during rqg_info_schema test
# #
CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1; CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2; CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
# Connection con1 # Connection con1
SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query"; SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query";
# Sending: # Sending:
......
...@@ -76,3 +76,40 @@ set @@log_slow_filter=default; ...@@ -76,3 +76,40 @@ set @@log_slow_filter=default;
set @@log_slow_verbosity=default; set @@log_slow_verbosity=default;
set global log_output= default; set global log_output= default;
truncate mysql.slow_log; truncate mysql.slow_log;
#
# MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned off
#
SET SESSION slow_query_log=OFF;
SET GLOBAL slow_query_log=OFF;
SET long_query_time=0.1;
# Although this query is disallowed by slow_query_log, it should still increment Slow_queries
SELECT VARIABLE_VALUE INTO @global_slow_queries
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='SLOW_QUERIES';
SELECT sleep(0.2) INTO @tmp FROM DUAL;
SELECT
CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment
FROM
INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE
VARIABLE_NAME='SLOW_QUERIES';
Slow_queries_increment
1
# Although this query is disallowed by log_slow_filter, it should still increment Slow_queries
SET log_slow_filter=filesort;
SELECT sleep(0.2) INTO @tmp FROM DUAL;
SELECT VARIABLE_VALUE INTO @global_slow_queries
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='SLOW_QUERIES';
SELECT sleep(0.2) INTO @tmp FROM DUAL;
SELECT
CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment
FROM
INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE
VARIABLE_NAME='SLOW_QUERIES';
Slow_queries_increment
1
SET log_slow_filter=DEFAULT;
SET @@long_query_time=default;
SET GLOBAL slow_query_log= @org_slow_query_log;
SET @org_slow_query_log= @@global.slow_query_log;
SET @org_log_output= @@global.log_output;
SET @org_log_slow_admin_statements= @@global.log_slow_admin_statements;
SET @@GLOBAL.slow_query_log=OFF;
SET @@GLOBAL.log_output='TABLE';
FLUSH SLOW LOGS;
SET @@GLOBAL.slow_query_log=ON;
SET @@GLOBAL.log_slow_admin_statements=ON;
SET SESSION debug_dbug="+d,simulate_slow_query";
CREATE PROCEDURE show_slow_log()
BEGIN
SELECT CONCAT('[slow] ', sql_text) AS sql_text
FROM mysql.slow_log
WHERE sql_text NOT LIKE '%debug_dbug%';
END
$$
#
# Expect all admin statements in the slow log (ON,DEFAULT)
#
SET @@GLOBAL.log_slow_admin_statements=ON;
SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log();
sql_text
[slow] TRUNCATE TABLE mysql.slow_log
[slow] CREATE TABLE t1 (a INT)
[slow] CREATE INDEX t1a ON t1 (a)
[slow] DROP INDEX t1a ON t1
[slow] DROP TABLE t1
[slow] CREATE TABLE t2 (a INT)
[slow] ALTER TABLE t2 RENAME t2
[slow] RENAME TABLE t2 TO t3
[slow] DROP TABLE t3
[slow] CREATE TABLE t4 (a INT)
[slow] PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'
[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1
[slow] DEALLOCATE PREPARE stmt
[slow] DROP TABLE t4
#
# Expect all admin statements in the slow log (ON,admin)
#
SET @@GLOBAL.log_slow_admin_statements=ON;
SET log_slow_filter=admin;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log();
sql_text
[slow] CREATE INDEX t1a ON t1 (a)
[slow] DROP INDEX t1a ON t1
[slow] ALTER TABLE t2 RENAME t2
[slow] RENAME TABLE t2 TO t3
[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1
#
# Expect none of admin DDL statements in the slow log (ON,filesort)
#
SET @@GLOBAL.log_slow_admin_statements=ON;
SET log_slow_filter=filesort;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log();
sql_text
#
# Expect none of admin statements in the slow log (OFF,DEFAULT)
#
SET @@GLOBAL.log_slow_admin_statements=OFF;
SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log();
sql_text
[slow] TRUNCATE TABLE mysql.slow_log
[slow] CREATE TABLE t1 (a INT)
[slow] DROP TABLE t1
[slow] CREATE TABLE t2 (a INT)
[slow] DROP TABLE t3
[slow] CREATE TABLE t4 (a INT)
[slow] PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'
[slow] DEALLOCATE PREPARE stmt
[slow] DROP TABLE t4
#
# Clean up
#
SET SESSION debug_dbug="-d,simulate_slow_query";
TRUNCATE mysql.slow_log;
SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
DROP PROCEDURE show_slow_log;
CREATE DATABASE db1;
CREATE USER u@localhost IDENTIFIED BY 'pw';
set global log_warnings=2;
connect(localhost,u,pw,db1,MASTER_PORT,MASTER_SOCKET);
ERROR 42000: Access denied for user 'u'@'localhost' to database 'db1'
FOUND /Access denied for user 'u'@'localhost' to database 'db1'/ in mysqld.1.err
set global log_warnings=@@log_warnings;
DROP DATABASE db1;
DROP USER u@localhost;
...@@ -1018,6 +1018,27 @@ execute stmt1; ...@@ -1018,6 +1018,27 @@ execute stmt1;
deallocate prepare stmt1; deallocate prepare stmt1;
drop view v3,v2,v1; drop view v3,v2,v1;
drop table t1,t2,t3; drop table t1,t2,t3;
create table t1 (id int not null, v1 varchar(10) not null);
insert into t1 values (1,1),(2,2);
create table t2 (log varchar(10) not null);
create trigger t1_after_update after update on t1
for each row insert into t2 values ('triggered');
create user foo;
grant select, insert, update, delete, create, drop, reload, index, alter, show databases, create temporary tables, lock tables, execute, create view, show view, create routine, alter routine, trigger on *.* to 'foo'@'%';
set global read_only=1;
create temporary table temp_t1 (id int not null, update_me varchar(10));
insert into temp_t1 values (1,1),(2,2),(3,3);
update temp_t1 left join t1 on temp_t1.id = t1.id set temp_t1.update_me = 'hello';
set global read_only = 0;
create table t3 (id int not null);
insert t3 values (2);
update t1 left join t3 on t1.id = t3.id set t1.v1 = 'hello';
select * from t2;
log
triggered
triggered
drop table t1,t2, t3;
drop user foo;
end of 5.5 tests end of 5.5 tests
# Bug mdev-5970 # Bug mdev-5970
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment