mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.1-base
into lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.1-rt-merge sql/handler.cc: Auto merged sql/log_event.cc: Auto merged sql/sql_update.cc: Auto merged
This commit is contained in:
@ -566,3 +566,35 @@ reap;
|
||||
connection default;
|
||||
drop table t2;
|
||||
disconnect flush;
|
||||
|
||||
#
|
||||
# Bug#30882 Dropping a temporary table inside a stored function may cause a server crash
|
||||
#
|
||||
# Test HANDLER statements in conjunction with temporary tables. While the temporary table
|
||||
# is open by a HANDLER, no other statement can access it.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create temporary table t1 (a int, b char(1), key a(a), key b(a,b));
|
||||
insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"),
|
||||
(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j");
|
||||
select a,b from t1;
|
||||
handler t1 open as a1;
|
||||
handler a1 read a first;
|
||||
handler a1 read a next;
|
||||
handler a1 read a next;
|
||||
--error ER_CANT_REOPEN_TABLE
|
||||
select a,b from t1;
|
||||
handler a1 read a prev;
|
||||
handler a1 read a prev;
|
||||
handler a1 read a=(6) where b="g";
|
||||
handler a1 close;
|
||||
select a,b from t1;
|
||||
handler t1 open as a2;
|
||||
handler a2 read a first;
|
||||
handler a2 read a last;
|
||||
handler a2 read a prev;
|
||||
handler a2 close;
|
||||
drop table t1;
|
||||
|
@ -1020,6 +1020,55 @@ SELECT * FROM t1 ORDER BY b DESC, a ASC;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo #
|
||||
--echo # Bug#27610: ALTER TABLE ROW_FORMAT=... does not rebuild the table.
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
--echo # - prepare;
|
||||
--echo
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
|
||||
CREATE TABLE t1(c INT)
|
||||
ENGINE = InnoDB
|
||||
ROW_FORMAT = COMPACT;
|
||||
|
||||
--echo
|
||||
--echo # - initial check;
|
||||
--echo
|
||||
|
||||
SELECT table_schema, table_name, row_format
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE table_schema = DATABASE() AND table_name = 't1';
|
||||
|
||||
--echo
|
||||
--echo # - change ROW_FORMAT and check;
|
||||
--echo
|
||||
|
||||
ALTER TABLE t1 ROW_FORMAT = REDUNDANT;
|
||||
|
||||
--echo
|
||||
|
||||
SELECT table_schema, table_name, row_format
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE table_schema = DATABASE() AND table_name = 't1';
|
||||
|
||||
--echo
|
||||
--echo # - that's it, cleanup.
|
||||
--echo
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
|
||||
|
@ -610,7 +610,6 @@ id ev_nm ev_cnt
|
||||
6 ev_sched_1823 6
|
||||
DROP TABLE event_log;
|
||||
SET GLOBAL event_scheduler = OFF;
|
||||
DROP DATABASE events_test;
|
||||
SET GLOBAL event_scheduler= ON;
|
||||
CREATE EVENT bug28641 ON SCHEDULE AT '2038.01.18 03:00:00'
|
||||
DO BEGIN
|
||||
@ -618,3 +617,105 @@ SELECT 1;
|
||||
END;|
|
||||
SET GLOBAL event_scheduler= OFF;
|
||||
DROP EVENT bug28641;
|
||||
|
||||
#####################################################################
|
||||
#
|
||||
# BUG#31111: --read-only crashes MySQL (events fail to load).
|
||||
#
|
||||
#####################################################################
|
||||
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
DROP EVENT IF EXISTS e1;
|
||||
DROP EVENT IF EXISTS e2;
|
||||
|
||||
GRANT EVENT ON *.* TO mysqltest_u1@localhost;
|
||||
|
||||
SET GLOBAL READ_ONLY = 1;
|
||||
|
||||
#
|
||||
# Connection: u1_con (mysqltest_u1@localhost/events_test).
|
||||
#
|
||||
|
||||
CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
|
||||
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
|
||||
|
||||
ALTER EVENT e1 COMMENT 'comment';
|
||||
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
|
||||
|
||||
DROP EVENT e1;
|
||||
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
|
||||
|
||||
#
|
||||
# Connection: root_con (root@localhost/events_test).
|
||||
#
|
||||
|
||||
CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
|
||||
|
||||
ALTER EVENT e1 COMMENT 'comment';
|
||||
|
||||
DROP EVENT e1;
|
||||
|
||||
SET GLOBAL READ_ONLY = 0;
|
||||
|
||||
#
|
||||
# Connection: u1_con (mysqltest_u1@localhost/test).
|
||||
#
|
||||
|
||||
CREATE EVENT e1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND DO SET @a = 1;
|
||||
CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO SET @a = 1;
|
||||
|
||||
SELECT
|
||||
event_name,
|
||||
last_executed IS NULL,
|
||||
definer
|
||||
FROM INFORMATION_SCHEMA.EVENTS
|
||||
WHERE event_schema = 'events_test';
|
||||
event_name last_executed IS NULL definer
|
||||
e1 1 mysqltest_u1@localhost
|
||||
e2 1 mysqltest_u1@localhost
|
||||
|
||||
#
|
||||
# Connection: root_con (root@localhost/events_test).
|
||||
#
|
||||
|
||||
SET GLOBAL READ_ONLY = 1;
|
||||
|
||||
SET GLOBAL EVENT_SCHEDULER = ON;
|
||||
|
||||
# Waiting for the event scheduler to execute and drop event e1...
|
||||
|
||||
# Waiting for the event scheduler to execute and update event e2...
|
||||
|
||||
SET GLOBAL EVENT_SCHEDULER = OFF;
|
||||
|
||||
SELECT
|
||||
event_name,
|
||||
last_executed IS NULL,
|
||||
definer
|
||||
FROM INFORMATION_SCHEMA.EVENTS
|
||||
WHERE event_schema = 'events_test';
|
||||
event_name last_executed IS NULL definer
|
||||
e2 0 mysqltest_u1@localhost
|
||||
|
||||
DROP EVENT e1;
|
||||
ERROR HY000: Unknown event 'e1'
|
||||
|
||||
# Cleanup.
|
||||
|
||||
DROP EVENT e2;
|
||||
|
||||
SET GLOBAL READ_ONLY = 0;
|
||||
|
||||
#
|
||||
# Connection: default
|
||||
#
|
||||
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
|
||||
#####################################################################
|
||||
#
|
||||
# End of BUG#31111.
|
||||
#
|
||||
#####################################################################
|
||||
|
||||
DROP DATABASE events_test;
|
||||
|
@ -2251,7 +2251,7 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
|
||||
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
|
||||
2 SUBQUERY t1 range NULL a 5 NULL 8
|
||||
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
|
||||
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -2268,7 +2268,7 @@ AND t1_outer1.b = t1_outer2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index
|
||||
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer
|
||||
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
|
||||
2 SUBQUERY t1 range NULL a 5 NULL 8
|
||||
EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
|
||||
FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -2299,8 +2299,7 @@ Handler_read_next 0
|
||||
FLUSH STATUS;
|
||||
DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x
|
||||
FROM t1) > 10000;
|
||||
Warnings:
|
||||
Error 1242 Subquery returns more than 1 row
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
SHOW STATUS LIKE 'handler_read__e%';
|
||||
Variable_name Value
|
||||
Handler_read_key 8
|
||||
|
@ -575,3 +575,65 @@ ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
handler t1 close;
|
||||
handler t2 close;
|
||||
drop table t2;
|
||||
drop table if exists t1;
|
||||
create temporary table t1 (a int, b char(1), key a(a), key b(a,b));
|
||||
insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"),
|
||||
(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j");
|
||||
select a,b from t1;
|
||||
a b
|
||||
0 a
|
||||
1 b
|
||||
2 c
|
||||
3 d
|
||||
4 e
|
||||
5 f
|
||||
6 g
|
||||
7 h
|
||||
8 i
|
||||
9 j
|
||||
handler t1 open as a1;
|
||||
handler a1 read a first;
|
||||
a b
|
||||
0 a
|
||||
handler a1 read a next;
|
||||
a b
|
||||
1 b
|
||||
handler a1 read a next;
|
||||
a b
|
||||
2 c
|
||||
select a,b from t1;
|
||||
ERROR HY000: Can't reopen table: 'a1'
|
||||
handler a1 read a prev;
|
||||
a b
|
||||
1 b
|
||||
handler a1 read a prev;
|
||||
a b
|
||||
0 a
|
||||
handler a1 read a=(6) where b="g";
|
||||
a b
|
||||
6 g
|
||||
handler a1 close;
|
||||
select a,b from t1;
|
||||
a b
|
||||
0 a
|
||||
1 b
|
||||
2 c
|
||||
3 d
|
||||
4 e
|
||||
5 f
|
||||
6 g
|
||||
7 h
|
||||
8 i
|
||||
9 j
|
||||
handler t1 open as a2;
|
||||
handler a2 read a first;
|
||||
a b
|
||||
0 a
|
||||
handler a2 read a last;
|
||||
a b
|
||||
9 j
|
||||
handler a2 read a prev;
|
||||
a b
|
||||
8 i
|
||||
handler a2 close;
|
||||
drop table t1;
|
||||
|
@ -575,3 +575,65 @@ ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
handler t1 close;
|
||||
handler t2 close;
|
||||
drop table t2;
|
||||
drop table if exists t1;
|
||||
create temporary table t1 (a int, b char(1), key a(a), key b(a,b));
|
||||
insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"),
|
||||
(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j");
|
||||
select a,b from t1;
|
||||
a b
|
||||
0 a
|
||||
1 b
|
||||
2 c
|
||||
3 d
|
||||
4 e
|
||||
5 f
|
||||
6 g
|
||||
7 h
|
||||
8 i
|
||||
9 j
|
||||
handler t1 open as a1;
|
||||
handler a1 read a first;
|
||||
a b
|
||||
0 a
|
||||
handler a1 read a next;
|
||||
a b
|
||||
1 b
|
||||
handler a1 read a next;
|
||||
a b
|
||||
2 c
|
||||
select a,b from t1;
|
||||
ERROR HY000: Can't reopen table: 'a1'
|
||||
handler a1 read a prev;
|
||||
a b
|
||||
1 b
|
||||
handler a1 read a prev;
|
||||
a b
|
||||
0 a
|
||||
handler a1 read a=(6) where b="g";
|
||||
a b
|
||||
6 g
|
||||
handler a1 close;
|
||||
select a,b from t1;
|
||||
a b
|
||||
0 a
|
||||
1 b
|
||||
2 c
|
||||
3 d
|
||||
4 e
|
||||
5 f
|
||||
6 g
|
||||
7 h
|
||||
8 i
|
||||
9 j
|
||||
handler t1 open as a2;
|
||||
handler a2 read a first;
|
||||
a b
|
||||
0 a
|
||||
handler a2 read a last;
|
||||
a b
|
||||
9 j
|
||||
handler a2 read a prev;
|
||||
a b
|
||||
8 i
|
||||
handler a2 close;
|
||||
drop table t1;
|
||||
|
@ -286,7 +286,7 @@ NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
|
||||
explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
2 DERIVED t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where; Using index
|
||||
2 DERIVED t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
|
||||
create table t3 like t0;
|
||||
insert into t3 select * from t0;
|
||||
alter table t3 add key9 int not null, add index i9(key9);
|
||||
|
@ -1287,6 +1287,40 @@ a b
|
||||
2 2
|
||||
3 2
|
||||
1 1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#27610: ALTER TABLE ROW_FORMAT=... does not rebuild the table.
|
||||
#
|
||||
|
||||
# - prepare;
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
CREATE TABLE t1(c INT)
|
||||
ENGINE = InnoDB
|
||||
ROW_FORMAT = COMPACT;
|
||||
|
||||
# - initial check;
|
||||
|
||||
SELECT table_schema, table_name, row_format
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE table_schema = DATABASE() AND table_name = 't1';
|
||||
table_schema table_name row_format
|
||||
test t1 Compact
|
||||
|
||||
# - change ROW_FORMAT and check;
|
||||
|
||||
ALTER TABLE t1 ROW_FORMAT = REDUNDANT;
|
||||
|
||||
SELECT table_schema, table_name, row_format
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE table_schema = DATABASE() AND table_name = 't1';
|
||||
table_schema table_name row_format
|
||||
test t1 Redundant
|
||||
|
||||
# - that's it, cleanup.
|
||||
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
CREATE TABLE `t2` (
|
||||
|
@ -530,3 +530,18 @@ ORDER BY c.b, c.d
|
||||
a b c d e f g h i j a b c d
|
||||
2 2 1 2004-11-30 12:00:00 1 0 0 0 0 0 2 3388000 -553000 NULL
|
||||
DROP TABLE t1, t2;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT);
|
||||
INSERT INTO t1 VALUES (), (), ();
|
||||
SELECT 1 AS c1
|
||||
FROM t1
|
||||
ORDER BY (
|
||||
SELECT 1 AS c2
|
||||
FROM t1
|
||||
GROUP BY GREATEST(LAST_INSERT_ID(), t1.a) ASC
|
||||
LIMIT 1);
|
||||
c1
|
||||
1
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
|
@ -2680,4 +2680,21 @@ t1 CREATE TABLE `t1` (
|
||||
KEY `c` (`c`(10))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (a int, b int);
|
||||
create table t2 like t1;
|
||||
insert into t1 (a, b) values (1,1), (1,2), (1,3), (1,4), (1,5),
|
||||
(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
|
||||
insert into t2 select a, max(b) from t1 group by a;
|
||||
prepare stmt from "delete from t2 where (select (select max(b) from t1 group
|
||||
by a having a < 2) x from t1) > 10000";
|
||||
delete from t2 where (select (select max(b) from t1 group
|
||||
by a having a < 2) x from t1) > 10000;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
execute stmt;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
execute stmt;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
deallocate prepare stmt;
|
||||
drop table t1, t2;
|
||||
End of 5.1 tests.
|
||||
|
@ -4081,6 +4081,41 @@ SELECT `x` FROM v3;
|
||||
x
|
||||
1
|
||||
DROP VIEW v1, v2, v3;
|
||||
|
||||
#
|
||||
# Bug#30736: Row Size Too Large Error Creating a Table and
|
||||
# Inserting Data.
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
|
||||
CREATE TABLE t1(
|
||||
c1 DECIMAL(10, 2),
|
||||
c2 FLOAT);
|
||||
|
||||
INSERT INTO t1 VALUES (0, 1), (2, 3), (4, 5);
|
||||
|
||||
CREATE TABLE t2(
|
||||
c3 DECIMAL(10, 2))
|
||||
SELECT
|
||||
c1 * c2 AS c3
|
||||
FROM t1;
|
||||
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
0.00 1
|
||||
2.00 3
|
||||
4.00 5
|
||||
|
||||
SELECT * FROM t2;
|
||||
c3
|
||||
0.00
|
||||
6.00
|
||||
20.00
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
||||
End of 5.0 tests
|
||||
create table t1(a INT, KEY (a));
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||
|
@ -1428,7 +1428,6 @@ create function bug20701() returns varchar(25) binary return "test";
|
||||
ERROR 42000: This version of MySQL doesn't yet support 'return value collation'
|
||||
create function bug20701() returns varchar(25) return "test";
|
||||
drop function bug20701;
|
||||
End of 5.1 tests
|
||||
create procedure proc_26503_error_1()
|
||||
begin
|
||||
retry:
|
||||
@ -1523,3 +1522,60 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
|
||||
SELECT ..inexistent();
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.inexistent()' at line 1
|
||||
USE test;
|
||||
create function f1() returns int
|
||||
begin
|
||||
set @test = 1, password = password('foo');
|
||||
return 1;
|
||||
end|
|
||||
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
|
||||
create trigger t1
|
||||
before insert on t2 for each row set password = password('foo');|
|
||||
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
|
||||
drop function if exists f1;
|
||||
drop function if exists f2;
|
||||
drop table if exists t1, t2;
|
||||
create function f1() returns int
|
||||
begin
|
||||
drop temporary table t1;
|
||||
return 1;
|
||||
end|
|
||||
create temporary table t1 as select f1();
|
||||
ERROR HY000: Can't reopen table: 't1'
|
||||
create function f2() returns int
|
||||
begin
|
||||
create temporary table t2 as select f1();
|
||||
return 1;
|
||||
end|
|
||||
create temporary table t1 as select f2();
|
||||
ERROR HY000: Can't reopen table: 't1'
|
||||
drop function f1;
|
||||
drop function f2;
|
||||
create function f1() returns int
|
||||
begin
|
||||
drop temporary table t2,t1;
|
||||
return 1;
|
||||
end|
|
||||
create function f2() returns int
|
||||
begin
|
||||
create temporary table t2 as select f1();
|
||||
return 1;
|
||||
end|
|
||||
create temporary table t1 as select f2();
|
||||
ERROR HY000: Can't reopen table: 't2'
|
||||
drop function f1;
|
||||
drop function f2;
|
||||
create temporary table t2(a int);
|
||||
select * from t2;
|
||||
a
|
||||
create function f2() returns int
|
||||
begin
|
||||
drop temporary table t2;
|
||||
return 1;
|
||||
end|
|
||||
select f2();
|
||||
f2()
|
||||
1
|
||||
drop function f2;
|
||||
drop table t2;
|
||||
ERROR 42S02: Unknown table 't2'
|
||||
End of 5.1 tests
|
||||
|
@ -11,7 +11,7 @@ RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
|
||||
CREATE AGGREGATE FUNCTION avgcost
|
||||
RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
|
||||
select myfunc_double();
|
||||
ERROR HY000: myfunc_double must have at least one argument
|
||||
ERROR HY000: Can't initialize function 'myfunc_double'; myfunc_double must have at least one argument
|
||||
select myfunc_double(1);
|
||||
myfunc_double(1)
|
||||
49.00
|
||||
@ -24,26 +24,26 @@ select myfunc_int();
|
||||
myfunc_int()
|
||||
0
|
||||
select lookup();
|
||||
ERROR HY000: Wrong arguments to lookup; Use the source
|
||||
ERROR HY000: Can't initialize function 'lookup'; Wrong arguments to lookup; Use the source
|
||||
select lookup("127.0.0.1");
|
||||
lookup("127.0.0.1")
|
||||
127.0.0.1
|
||||
select lookup(127,0,0,1);
|
||||
ERROR HY000: Wrong arguments to lookup; Use the source
|
||||
ERROR HY000: Can't initialize function 'lookup'; Wrong arguments to lookup; Use the source
|
||||
select lookup("localhost");
|
||||
lookup("localhost")
|
||||
127.0.0.1
|
||||
select reverse_lookup();
|
||||
ERROR HY000: Wrong number of arguments to reverse_lookup; Use the source
|
||||
ERROR HY000: Can't initialize function 'reverse_lookup'; Wrong number of arguments to reverse_lookup; Use the source
|
||||
select reverse_lookup("127.0.0.1");
|
||||
select reverse_lookup(127,0,0,1);
|
||||
select reverse_lookup("localhost");
|
||||
reverse_lookup("localhost")
|
||||
NULL
|
||||
select avgcost();
|
||||
ERROR HY000: wrong number of arguments: AVGCOST() requires two arguments
|
||||
ERROR HY000: Can't initialize function 'avgcost'; wrong number of arguments: AVGCOST() requires two arguments
|
||||
select avgcost(100,23.76);
|
||||
ERROR HY000: wrong argument type: AVGCOST() requires an INT and a REAL
|
||||
ERROR HY000: Can't initialize function 'avgcost'; wrong argument type: AVGCOST() requires an INT and a REAL
|
||||
create table t1(sum int, price float(24));
|
||||
insert into t1 values(100, 50.00), (100, 100.00);
|
||||
select avgcost(sum, price) from t1;
|
||||
|
@ -53,7 +53,7 @@ DELETE FROM t2 WHERE a = 2;
|
||||
--echo ******************** LOAD DATA INFILE ********************
|
||||
--exec cp ./suite/rpl/data/rpl_mixed.dat $MYSQLTEST_VARDIR/tmp/
|
||||
LOAD DATA INFILE '../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
|
||||
--exec rm $MYSQLTEST_VARDIR/tmp/rpl_mixed.dat
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/rpl_mixed.dat
|
||||
SELECT * FROM t1;
|
||||
--source suite/rpl/include/rpl_mixed_check_select.inc
|
||||
--source suite/rpl/include/rpl_mixed_clear_tables.inc
|
||||
|
@ -454,7 +454,8 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
|
||||
--echo "Should have only 2 processes: the scheduler and the locked event"
|
||||
let $wait_condition= select count(*) = 2 from information_schema.processlist
|
||||
where ( (state like 'User lock%' AND info like 'select get_lock%')
|
||||
OR (command='Daemon' AND user='event_scheduler'));
|
||||
OR (command='Daemon' AND user='event_scheduler' AND
|
||||
state = 'Waiting for next activation'));
|
||||
--source include/wait_condition.inc
|
||||
|
||||
select /*2*/ user, host, db, command, state, info
|
||||
|
@ -712,18 +712,6 @@ DROP TABLE event_log;
|
||||
#DROP DATABASE ev_db_1;
|
||||
SET GLOBAL event_scheduler = OFF;
|
||||
|
||||
#
|
||||
# End of tests
|
||||
#
|
||||
|
||||
let $wait_condition=
|
||||
select count(*) = 0 from information_schema.processlist
|
||||
where db='events_test' and command = 'Connect' and user=current_user();
|
||||
--source include/wait_condition.inc
|
||||
|
||||
DROP DATABASE events_test;
|
||||
|
||||
|
||||
#
|
||||
# Bug#28641 CREATE EVENT with '2038.01.18 03:00:00' let server crash.
|
||||
#
|
||||
@ -737,3 +725,215 @@ CREATE EVENT bug28641 ON SCHEDULE AT '2038.01.18 03:00:00'
|
||||
DELIMITER ;|
|
||||
SET GLOBAL event_scheduler= OFF;
|
||||
DROP EVENT bug28641;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo #####################################################################
|
||||
--echo #
|
||||
--echo # BUG#31111: --read-only crashes MySQL (events fail to load).
|
||||
--echo #
|
||||
--echo #####################################################################
|
||||
--echo
|
||||
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
|
||||
--disable_warnings
|
||||
DROP EVENT IF EXISTS e1;
|
||||
DROP EVENT IF EXISTS e2;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
|
||||
# Check that an ordinary user can not create/update/drop events in the
|
||||
# read-only mode.
|
||||
|
||||
GRANT EVENT ON *.* TO mysqltest_u1@localhost;
|
||||
|
||||
--echo
|
||||
|
||||
SET GLOBAL READ_ONLY = 1;
|
||||
|
||||
--echo
|
||||
|
||||
--echo #
|
||||
--echo # Connection: u1_con (mysqltest_u1@localhost/events_test).
|
||||
--echo #
|
||||
|
||||
--connect(u1_con,localhost,mysqltest_u1,,events_test)
|
||||
|
||||
--echo
|
||||
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
|
||||
|
||||
--echo
|
||||
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
ALTER EVENT e1 COMMENT 'comment';
|
||||
|
||||
--echo
|
||||
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
DROP EVENT e1;
|
||||
|
||||
--echo
|
||||
|
||||
# Check that the super user still can create/update/drop events.
|
||||
|
||||
--echo #
|
||||
--echo # Connection: root_con (root@localhost/events_test).
|
||||
--echo #
|
||||
|
||||
--connect(root_con,localhost,root,,events_test)
|
||||
|
||||
--echo
|
||||
|
||||
CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
|
||||
|
||||
--echo
|
||||
|
||||
ALTER EVENT e1 COMMENT 'comment';
|
||||
|
||||
--echo
|
||||
|
||||
DROP EVENT e1;
|
||||
|
||||
--echo
|
||||
|
||||
#
|
||||
# Switch to read-write mode; create test events under the user mysqltest_u1;
|
||||
# switch back to read-only mode.
|
||||
#
|
||||
|
||||
SET GLOBAL READ_ONLY = 0;
|
||||
|
||||
--echo
|
||||
|
||||
--echo #
|
||||
--echo # Connection: u1_con (mysqltest_u1@localhost/test).
|
||||
--echo #
|
||||
|
||||
--connection u1_con
|
||||
|
||||
--echo
|
||||
|
||||
CREATE EVENT e1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND DO SET @a = 1;
|
||||
CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO SET @a = 1;
|
||||
|
||||
--echo
|
||||
|
||||
SELECT
|
||||
event_name,
|
||||
last_executed IS NULL,
|
||||
definer
|
||||
FROM INFORMATION_SCHEMA.EVENTS
|
||||
WHERE event_schema = 'events_test';
|
||||
|
||||
--echo
|
||||
|
||||
--echo #
|
||||
--echo # Connection: root_con (root@localhost/events_test).
|
||||
--echo #
|
||||
|
||||
--connection root_con
|
||||
|
||||
--echo
|
||||
|
||||
SET GLOBAL READ_ONLY = 1;
|
||||
|
||||
# Check that the event scheduler is able to update event.
|
||||
|
||||
--echo
|
||||
|
||||
SET GLOBAL EVENT_SCHEDULER = ON;
|
||||
|
||||
--echo
|
||||
|
||||
--echo # Waiting for the event scheduler to execute and drop event e1...
|
||||
|
||||
let $wait_timeout = 2;
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 0
|
||||
FROM INFORMATION_SCHEMA.EVENTS
|
||||
WHERE event_schema = 'events_test' AND event_name = 'e1';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo
|
||||
|
||||
--echo # Waiting for the event scheduler to execute and update event e2...
|
||||
|
||||
let $wait_condition =
|
||||
SELECT last_executed IS NOT NULL
|
||||
FROM INFORMATION_SCHEMA.EVENTS
|
||||
WHERE event_schema = 'events_test' AND event_name = 'e2';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo
|
||||
|
||||
SET GLOBAL EVENT_SCHEDULER = OFF;
|
||||
|
||||
--echo
|
||||
|
||||
SELECT
|
||||
event_name,
|
||||
last_executed IS NULL,
|
||||
definer
|
||||
FROM INFORMATION_SCHEMA.EVENTS
|
||||
WHERE event_schema = 'events_test';
|
||||
|
||||
--echo
|
||||
|
||||
--error ER_EVENT_DOES_NOT_EXIST
|
||||
DROP EVENT e1;
|
||||
|
||||
--echo
|
||||
--echo # Cleanup.
|
||||
--echo
|
||||
|
||||
DROP EVENT e2;
|
||||
|
||||
--echo
|
||||
|
||||
SET GLOBAL READ_ONLY = 0;
|
||||
|
||||
--echo
|
||||
|
||||
--echo #
|
||||
--echo # Connection: default
|
||||
--echo #
|
||||
|
||||
--disconnect u1_con
|
||||
--disconnect root_con
|
||||
--connection default
|
||||
|
||||
--echo
|
||||
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
|
||||
--echo
|
||||
--echo #####################################################################
|
||||
--echo #
|
||||
--echo # End of BUG#31111.
|
||||
--echo #
|
||||
--echo #####################################################################
|
||||
--echo
|
||||
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# End of tests
|
||||
#
|
||||
# !!! KEEP this section AT THE END of this file !!!
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
let $wait_condition=
|
||||
select count(*) = 0 from information_schema.processlist
|
||||
where db='events_test' and command = 'Connect' and user=current_user();
|
||||
--source include/wait_condition.inc
|
||||
|
||||
DROP DATABASE events_test;
|
||||
|
||||
# THIS MUST BE THE LAST LINE in this file.
|
||||
|
@ -890,6 +890,7 @@ FLUSH STATUS;
|
||||
DELETE FROM t3 WHERE (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) > 10000;
|
||||
SHOW STATUS LIKE 'handler_read__e%';
|
||||
FLUSH STATUS;
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x
|
||||
FROM t1) > 10000;
|
||||
SHOW STATUS LIKE 'handler_read__e%';
|
||||
|
@ -501,3 +501,26 @@ ORDER BY c.b, c.d
|
||||
;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Bug #31148: bool close_thread_table(THD*, TABLE**): Assertion
|
||||
# `table->key_read == 0' failed.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT);
|
||||
|
||||
INSERT INTO t1 VALUES (), (), ();
|
||||
|
||||
SELECT 1 AS c1
|
||||
FROM t1
|
||||
ORDER BY (
|
||||
SELECT 1 AS c2
|
||||
FROM t1
|
||||
GROUP BY GREATEST(LAST_INSERT_ID(), t1.a) ASC
|
||||
LIMIT 1);
|
||||
|
||||
DROP TABLE t1;
|
||||
|
@ -2778,4 +2778,38 @@ execute stmt;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #32030 DELETE does not return an error and deletes rows if error
|
||||
# evaluating WHERE
|
||||
#
|
||||
# Test that there is an error for prepared delete just like for the normal
|
||||
# one.
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
create table t1 (a int, b int);
|
||||
create table t2 like t1;
|
||||
|
||||
insert into t1 (a, b) values (1,1), (1,2), (1,3), (1,4), (1,5),
|
||||
(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
|
||||
|
||||
insert into t2 select a, max(b) from t1 group by a;
|
||||
|
||||
prepare stmt from "delete from t2 where (select (select max(b) from t1 group
|
||||
by a having a < 2) x from t1) > 10000";
|
||||
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
delete from t2 where (select (select max(b) from t1 group
|
||||
by a having a < 2) x from t1) > 10000;
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
execute stmt;
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
execute stmt;
|
||||
|
||||
deallocate prepare stmt;
|
||||
drop table t1, t2;
|
||||
|
||||
|
||||
|
||||
--echo End of 5.1 tests.
|
||||
|
@ -3473,6 +3473,54 @@ DROP VIEW v1, v2, v3;
|
||||
|
||||
--enable_ps_protocol
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo #
|
||||
--echo # Bug#30736: Row Size Too Large Error Creating a Table and
|
||||
--echo # Inserting Data.
|
||||
--echo #
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
|
||||
CREATE TABLE t1(
|
||||
c1 DECIMAL(10, 2),
|
||||
c2 FLOAT);
|
||||
|
||||
--echo
|
||||
|
||||
INSERT INTO t1 VALUES (0, 1), (2, 3), (4, 5);
|
||||
|
||||
--echo
|
||||
|
||||
CREATE TABLE t2(
|
||||
c3 DECIMAL(10, 2))
|
||||
SELECT
|
||||
c1 * c2 AS c3
|
||||
FROM t1;
|
||||
|
||||
--echo
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo
|
||||
|
||||
SELECT * FROM t2;
|
||||
|
||||
--echo
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
||||
--echo
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
|
@ -2078,10 +2078,6 @@ create function bug20701() returns varchar(25) binary return "test";
|
||||
create function bug20701() returns varchar(25) return "test";
|
||||
drop function bug20701;
|
||||
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
|
||||
#
|
||||
# Bug#26503 (Illegal SQL exception handler code causes the server to crash)
|
||||
#
|
||||
@ -2222,6 +2218,93 @@ SELECT .inexistent();
|
||||
SELECT ..inexistent();
|
||||
USE test;
|
||||
|
||||
#
|
||||
# Bug#30904 SET PASSWORD statement is non-transactional
|
||||
#
|
||||
|
||||
delimiter |;
|
||||
|
||||
--error ER_SP_CANT_SET_AUTOCOMMIT
|
||||
create function f1() returns int
|
||||
begin
|
||||
set @test = 1, password = password('foo');
|
||||
return 1;
|
||||
end|
|
||||
|
||||
--error ER_SP_CANT_SET_AUTOCOMMIT
|
||||
create trigger t1
|
||||
before insert on t2 for each row set password = password('foo');|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
#
|
||||
# Bug#30882 Dropping a temporary table inside a stored function may cause a server crash
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop function if exists f1;
|
||||
drop function if exists f2;
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
delimiter |;
|
||||
create function f1() returns int
|
||||
begin
|
||||
drop temporary table t1;
|
||||
return 1;
|
||||
end|
|
||||
delimiter ;|
|
||||
--error ER_CANT_REOPEN_TABLE
|
||||
create temporary table t1 as select f1();
|
||||
|
||||
delimiter |;
|
||||
create function f2() returns int
|
||||
begin
|
||||
create temporary table t2 as select f1();
|
||||
return 1;
|
||||
end|
|
||||
delimiter ;|
|
||||
--error ER_CANT_REOPEN_TABLE
|
||||
create temporary table t1 as select f2();
|
||||
|
||||
drop function f1;
|
||||
drop function f2;
|
||||
|
||||
delimiter |;
|
||||
create function f1() returns int
|
||||
begin
|
||||
drop temporary table t2,t1;
|
||||
return 1;
|
||||
end|
|
||||
create function f2() returns int
|
||||
begin
|
||||
create temporary table t2 as select f1();
|
||||
return 1;
|
||||
end|
|
||||
delimiter ;|
|
||||
--error ER_CANT_REOPEN_TABLE
|
||||
create temporary table t1 as select f2();
|
||||
|
||||
drop function f1;
|
||||
drop function f2;
|
||||
|
||||
create temporary table t2(a int);
|
||||
select * from t2;
|
||||
delimiter |;
|
||||
create function f2() returns int
|
||||
begin
|
||||
drop temporary table t2;
|
||||
return 1;
|
||||
end|
|
||||
delimiter ;|
|
||||
select f2();
|
||||
|
||||
drop function f2;
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table t2;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
@ -35,20 +35,20 @@ eval CREATE FUNCTION reverse_lookup
|
||||
eval CREATE AGGREGATE FUNCTION avgcost
|
||||
RETURNS REAL SONAME "$UDF_EXAMPLE_LIB";
|
||||
|
||||
--error 0
|
||||
--error ER_CANT_INITIALIZE_UDF
|
||||
select myfunc_double();
|
||||
select myfunc_double(1);
|
||||
select myfunc_double(78654);
|
||||
--error 1305
|
||||
select myfunc_nonexist();
|
||||
select myfunc_int();
|
||||
--error 0
|
||||
--error ER_CANT_INITIALIZE_UDF
|
||||
select lookup();
|
||||
select lookup("127.0.0.1");
|
||||
--error 0
|
||||
--error ER_CANT_INITIALIZE_UDF
|
||||
select lookup(127,0,0,1);
|
||||
select lookup("localhost");
|
||||
--error 0
|
||||
--error ER_CANT_INITIALIZE_UDF
|
||||
select reverse_lookup();
|
||||
|
||||
# These two functions should return "localhost", but it's
|
||||
@ -59,9 +59,9 @@ select reverse_lookup(127,0,0,1);
|
||||
--enable_result_log
|
||||
|
||||
select reverse_lookup("localhost");
|
||||
--error 0
|
||||
--error ER_CANT_INITIALIZE_UDF
|
||||
select avgcost();
|
||||
--error 0
|
||||
--error ER_CANT_INITIALIZE_UDF
|
||||
select avgcost(100,23.76);
|
||||
create table t1(sum int, price float(24));
|
||||
insert into t1 values(100, 50.00), (100, 100.00);
|
||||
|
Reference in New Issue
Block a user