summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/events.test3
-rw-r--r--mysql-test/t/events_bugs.test224
-rw-r--r--mysql-test/t/group_min_max.test1
-rw-r--r--mysql-test/t/key.test40
-rw-r--r--mysql-test/t/mysqlbinlog.test28
-rw-r--r--mysql-test/t/partition.test107
-rw-r--r--mysql-test/t/partition_archive.test32
-rw-r--r--mysql-test/t/partition_blackhole.test24
-rw-r--r--mysql-test/t/partition_csv.test38
-rw-r--r--mysql-test/t/ps.test34
-rw-r--r--mysql-test/t/select.test48
-rw-r--r--mysql-test/t/sp-error.test91
-rw-r--r--mysql-test/t/udf.test12
13 files changed, 574 insertions, 108 deletions
diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test
index d1ca5f1b609..a4c7eaebc30 100644
--- a/mysql-test/t/events.test
+++ b/mysql-test/t/events.test
@@ -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
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
index 36052fdb9af..ebd86f3a3d2 100644
--- a/mysql-test/t/events_bugs.test
+++ b/mysql-test/t/events_bugs.test
@@ -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.
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index cf25b4c61be..9d1e065797d 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -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%';
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index f1eb8e68b49..31d5ac5201b 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -501,3 +501,43 @@ 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;
+
+
+#
+# Bug #31974: Wrong EXPLAIN output
+#
+
+CREATE TABLE t1 (a INT, b INT, INDEX (a,b));
+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);
+EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
+ (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
+SELECT 1 as RES FROM t1 AS t1_outer WHERE
+ (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 25bd9a402ae..edaf07a64db 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -250,4 +250,32 @@ flush logs;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000016 >/dev/null 2>/dev/null
--exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000016 >/dev/null 2>/dev/null
+--echo BUG#31611: Security risk with BINLOG statement
+
+SET BINLOG_FORMAT=ROW;
+CREATE DATABASE mysqltest1;
+CREATE USER untrusted@localhost;
+GRANT SELECT ON mysqltest1.* TO untrusted@localhost;
+
+SHOW GRANTS FOR untrusted@localhost;
+USE mysqltest1;
+CREATE TABLE t1 (a INT, b CHAR(64));
+flush logs;
+INSERT INTO t1 VALUES (1,USER());
+flush logs;
+echo mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql;
+exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
+connect (unsecure,localhost,untrusted,,mysqltest1);
+echo mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql;
+error 1;
+exec $MYSQL mysqltest1 -uuntrusted < $MYSQLTEST_VARDIR/tmp/bug31611.sql;
+connection unsecure;
+error ER_TABLEACCESS_DENIED_ERROR;
+INSERT INTO t1 VALUES (1,USER());
+
+SELECT * FROM t1;
+connection default;
+DROP DATABASE mysqltest1;
+DROP USER untrusted@localhost;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index d208fd46138..a1d01b9ae19 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -1,10 +1,14 @@
#--disable_abort_on_error
#
# Simple test for the partition storage engine
-# Taken fromm the select test
+# taken from the select test.
#
-source include/have_partition.inc;
-source include/have_archive.inc;
+# Last update:
+# 2007-10-22 mleich - Move ARCHIVE, BLACKHOLE and CSV related sub tests to
+# new tests. Reason: All these might be not available.
+# - Minor cleanup
+#
+--source include/have_partition.inc
--disable_warnings
drop table if exists t1;
@@ -13,19 +17,19 @@ drop table if exists t1;
#
# Bug 15890: Strange number of partitions accepted
#
--- error 1064
+-- error ER_PARSE_ERROR
create table t1 (a int)
partition by key(a)
partitions 0.2+e1;
--- error 1064
+-- error ER_PARSE_ERROR
create table t1 (a int)
partition by key(a)
partitions -1;
--- error 1064
+-- error ER_PARSE_ERROR
create table t1 (a int)
partition by key(a)
partitions 1.5;
--- error 1064
+-- error ER_PARSE_ERROR
create table t1 (a int)
partition by key(a)
partitions 1e+300;
@@ -33,7 +37,7 @@ partitions 1e+300;
#
# Bug 21350: Data Directory problems
#
--- error 1103
+-- error ER_WRONG_TABLE_NAME
create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
@@ -42,7 +46,7 @@ partition by key (a)
# Insert a test that manages to create the first partition and fails with
# the second, ensure that we clean up afterwards in a proper manner.
#
---error 1103
+--error ER_WRONG_TABLE_NAME
create table t1 (a int)
partition by key (a)
(partition p0,
@@ -64,23 +68,14 @@ drop procedure pz;
drop table t1;
#
-# Bug 19307: CSV engine crashes
-#
---error ER_PARTITION_MERGE_ERROR
-create table t1 (a int)
-engine = csv
-partition by list (a)
-(partition p0 values in (null));
-
-#
# BUG 16002: Handle unsigned integer functions properly
#
---error 1064
+--error ER_PARSE_ERROR
create table t1 (a bigint)
partition by range (a)
(partition p0 values less than (0xFFFFFFFFFFFFFFFF),
partition p1 values less than (10));
---error 1064
+--error ER_PARSE_ERROR
create table t1 (a bigint)
partition by list (a)
(partition p0 values in (0xFFFFFFFFFFFFFFFF),
@@ -102,15 +97,6 @@ select * from t1 where (a + 1) > 10;
drop table t1;
#
-# Bug 19307: CSV engine crashes
-#
---error ER_PARTITION_MERGE_ERROR
-create table t1 (a int)
-engine = csv
-partition by list (a)
-(partition p0 values in (null));
-
-#
# Added test case
#
create table t1 (a int)
@@ -414,34 +400,6 @@ analyze table t1;
drop table t1;
#
-# BUG 14524
-#
-# Disable warnings to allow this test case to work without
-# the Blackhole engine.
---disable_warnings
-CREATE TABLE `t1` (
- `id` int(11) default NULL
-) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
---enable_warnings
-SELECT * FROM t1;
-
-drop table t1;
-
-#
-# BUG 14524
-#
-# Disable warnings to allow this test case to work without
-# the Blackhole engine.
---disable_warnings
-CREATE TABLE `t1` (
- `id` int(11) default NULL
-) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
---enable_warnings
-SELECT * FROM t1;
-
-drop table t1;
-
-#
# BUG 15221 (Cannot reorganize with the same name)
#
create table t1
@@ -767,7 +725,7 @@ create table t1 (a int)
partition by list (a)
(partition p0 values in (1));
---error 1064
+--error ER_PARSE_ERROR
alter table t1 rebuild partition;
drop table t1;
@@ -811,14 +769,14 @@ drop table t1;
#
# BUG 15407 Crash with subpartition
#
---error 1064
+--error ER_PARSE_ERROR
create table t1 (a int, b int)
partition by range (a)
subpartition by hash(a)
(partition p0 values less than (0) (subpartition sp0),
partition p1 values less than (1));
---error 1064
+--error ER_PARSE_ERROR
create table t1 (a int, b int)
partition by range (a)
subpartition by hash(a)
@@ -876,7 +834,7 @@ create table t1 (a int)
partition by list (a)
(partition p0 values in (1));
---error 1064
+--error ER_PARSE_ERROR
alter table t1 rebuild partition;
drop table t1;
@@ -938,7 +896,7 @@ drop table t1;
#
prepare stmt1 from 'create table t1 (s1 int) partition by hash (s1)';
execute stmt1;
---error 1050
+--error ER_TABLE_EXISTS_ERROR
execute stmt1;
drop table t1;
@@ -1127,7 +1085,7 @@ PARTITION BY LIST (a)
SHOW CREATE TABLE t1;
DROP TABLE t1;
---error 1064
+--error ER_PARSE_ERROR
CREATE TABLE t1 (a int)
PARTITION BY RANGE(a)
(PARTITION p0 VALUES LESS THAN (NULL));
@@ -1223,23 +1181,6 @@ OPTIMIZE TABLE t1;
drop table t1;
#
-# Bug 17310 Partitions: Bugs with archived partitioned tables
-#
-create database db99;
-use db99;
-create table t1 (a int not null)
-engine=archive
-partition by list (a)
-(partition p0 values in (1), partition p1 values in (2));
-insert into t1 values (1), (2);
---error 0, 1005
-create index inx on t1 (a);
-alter table t1 add partition (partition p2 values in (3));
-alter table t1 drop partition p2;
-use test;
-drop database db99;
-
-#
#BUG 17138 Problem with stored procedure and analyze partition
#
--disable_warnings
@@ -1510,12 +1451,8 @@ use test;
# BUG #18198: Case no longer supported, test case removed
#
-#
-# Bug #29444: crash with partition refering to table in create-select
-#
-
create table t2 (b int);
---error 1054
+--error ER_BAD_FIELD_ERROR
create table t1 (b int)
PARTITION BY RANGE (t2.b) (
PARTITION p1 VALUES LESS THAN (10),
diff --git a/mysql-test/t/partition_archive.test b/mysql-test/t/partition_archive.test
new file mode 100644
index 00000000000..3109894d9c9
--- /dev/null
+++ b/mysql-test/t/partition_archive.test
@@ -0,0 +1,32 @@
+# Tests for the partition storage engine in connection with the
+# storage engine ARCHIVE.
+#
+# Creation:
+# 2007-10-18 mleich - Move ARCHIVE related sub tests of partition.test to
+# this test. Reason: ARCHIVE is not everytime available.
+# - Minor cleanup
+#
+
+--source include/have_partition.inc
+--source include/have_archive.inc
+
+
+#
+# Bug 17310 Partitions: Bugs with archived partitioned tables
+#
+--disable_warnings
+drop database if exists db99;
+--enable_warnings
+create database db99;
+use db99;
+create table t1 (a int not null)
+engine=archive
+partition by list (a)
+(partition p0 values in (1), partition p1 values in (2));
+insert into t1 values (1), (2);
+--error 0, ER_CANT_CREATE_TABLE
+create index inx on t1 (a);
+alter table t1 add partition (partition p2 values in (3));
+alter table t1 drop partition p2;
+use test;
+drop database db99;
diff --git a/mysql-test/t/partition_blackhole.test b/mysql-test/t/partition_blackhole.test
new file mode 100644
index 00000000000..9344ecb3b62
--- /dev/null
+++ b/mysql-test/t/partition_blackhole.test
@@ -0,0 +1,24 @@
+# Tests for the partition storage engine in connection with the
+# storage engine BLACKHOLE.
+#
+# Creation:
+# 2007-10-18 mleich - Move BLACKHOLE related sub tests of partition.test to
+# this test. Reason: BLACKHOLE is not everytime available.
+# - Minor cleanup
+#
+
+--source include/have_partition.inc
+--source include/have_blackhole.inc
+
+#
+# Bug#14524 Partitions: crash if blackhole
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE `t1` (
+ `id` int(11) default NULL
+) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
+SELECT * FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/partition_csv.test b/mysql-test/t/partition_csv.test
new file mode 100644
index 00000000000..aa3d9d67c26
--- /dev/null
+++ b/mysql-test/t/partition_csv.test
@@ -0,0 +1,38 @@
+# Tests for the partition storage engine in connection with the
+# storage engine CSV.
+#
+# Creation:
+# 2007-10-18 mleich - Move CSV related sub tests of partition.test to
+# this test. Reason: CSV is not everytime available.
+# - Minor cleanup
+#
+
+--source include/have_partition.inc
+--source include/have_csv.inc
+
+#
+# Bug#19307: Partitions: csv delete failure
+# = CSV engine crashes
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+--error ER_PARTITION_MERGE_ERROR
+create table t1 (a int)
+engine = csv
+partition by list (a)
+(partition p0 values in (null));
+
+#
+# Bug#27816: Log tables ran with partitions crashes the server when logging
+# is enabled.
+#
+USE mysql;
+SET GLOBAL general_log = 0;
+ALTER TABLE general_log ENGINE = MyISAM;
+--error ER_WRONG_USAGE
+ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
+ (PARTITION p0 VALUES LESS THAN (733144),
+ PARTITION p1 VALUES LESS THAN (3000000));
+ALTER TABLE general_log ENGINE = CSV;
+SET GLOBAL general_log = 1;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index dea86bdd2fa..fd7caeb195e 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -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.
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 76a66cc4783..71a7caba399 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -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
#
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index a956a246770..606c2a673bc 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -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)
#
@@ -2223,6 +2219,93 @@ 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
#
#--disable_warnings
diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test
index 663dc08d72e..32cfca57546 100644
--- a/mysql-test/t/udf.test
+++ b/mysql-test/t/udf.test
@@ -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);