mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 21:42:35 +01:00
1945734c2d
during EXPLAIN Before the patch, send_eof() of some subclasses of select_result (e.g., select_send::send_eof()) could handle being called after an error had occured while others could not. The methods that were not well-behaved would trigger an ASSERT on debug builds. Release builds were not affected. Consider the following query as an example for how the ASSERT could be triggered: A user without execute privilege on f() does SELECT MAX(key1) INTO @dummy FROM t1 WHERE f() < 1; resulting in "ERROR 42000: execute command denied to user..." The server would end the query by calling send_eof(). The fact that the error had occured would make the ASSERT trigger. select_dumpvar::send_eof() was the offending method in the bug report, but the problem also applied to other subclasses of select_result. This patch uniforms send_eof() of all subclasses of select_result to handle being called after an error has occured. mysql-test/r/not_embedded_server.result: Added test for BUG#54812 mysql-test/t/not_embedded_server.test: Added test for BUG#54812 sql/sql_class.cc: send_eof() of all subclasses of select_result can now handle being called after an error has occured. sql/sql_insert.cc: send_eof() of all subclasses of select_result can now handle being called after an error has occured. Also fix call to abort() in select_create::send_eof(), which was supposed to abort the result set, not terminate the server. This call to abort() should have been changed when the function was renamed from abort_result_set() but was forgotten. New test case added by BUG#54812 covered this line and terminated server. sql/sql_prepare.cc: send_eof() of all subclasses of select_result can now handle being called after an error has occured. sql/sql_update.cc: send_eof() of all subclasses of select_result can now handle being called after an error has occured.
110 lines
2.9 KiB
Text
110 lines
2.9 KiB
Text
#
|
|
# Here we collect tests that doesn't work with the embedded server
|
|
#
|
|
|
|
-- source include/not_embedded.inc
|
|
|
|
# The following fails sporadically because 'check-testcase' runs
|
|
# queries before this test and there is no way to guarantee that any
|
|
# previous process finishes. The purpose of the test is not clearly
|
|
# stated, there is no reference to any bug report, and "select from
|
|
# I_S from prepared statement" doesn't look like something that's
|
|
# really imporant to test. I'm commenting out this for now. If
|
|
# anyone wants to keep this, please fix the race and motivate why we
|
|
# need to test this. If you see this comment and it is after mid-2009
|
|
# or so, feel free to remove this test from the file. /Sven
|
|
#
|
|
#
|
|
## Show full process list with prepare
|
|
## To not show other connections, this must be the first test and we must
|
|
## have a server restart before this one
|
|
##
|
|
## We don't have any 4.1 tests as we use I_S to query the PROCESSLIST to
|
|
## exclude system threads that may/may not be active in the server
|
|
## (namely the ndb injector thread)
|
|
##
|
|
## End of 4.1 tests
|
|
#
|
|
#prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' ';
|
|
#--replace_column 1 number 6 time 3 localhost
|
|
#execute stmt1;
|
|
#deallocate prepare stmt1;
|
|
|
|
call mtr.add_suppression("Can't open and lock privilege tables: Table 'host' was not locked with LOCK TABLES");
|
|
|
|
#
|
|
# Bug#43835: SHOW VARIABLES does not include 0 for slave_skip_errors
|
|
#
|
|
|
|
SHOW VARIABLES like 'slave_skip_errors';
|
|
|
|
# End of 5.1 tests
|
|
|
|
--echo #
|
|
--echo # WL#4284: Transactional DDL locking
|
|
--echo #
|
|
--echo # FLUSH PRIVILEGES should not implicitly unlock locked tables.
|
|
--echo #
|
|
--disable_warnings
|
|
drop table if exists t1;
|
|
--enable_warnings
|
|
create table t1 (c1 int);
|
|
lock tables t1 read;
|
|
--error ER_TABLE_NOT_LOCKED
|
|
flush privileges;
|
|
unlock tables;
|
|
drop table t1;
|
|
|
|
--echo #
|
|
--echo # Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN
|
|
--echo #
|
|
|
|
CREATE USER nopriv_user@localhost;
|
|
|
|
connection default;
|
|
--echo connection: default
|
|
|
|
--disable_warnings
|
|
DROP TABLE IF EXISTS t1,t2,t3;
|
|
DROP FUNCTION IF EXISTS f;
|
|
--enable_warnings
|
|
|
|
CREATE TABLE t1 (key1 INT PRIMARY KEY);
|
|
CREATE TABLE t2 (key2 INT);
|
|
INSERT INTO t1 VALUES (1),(2);
|
|
|
|
CREATE FUNCTION f() RETURNS INT RETURN 1;
|
|
|
|
GRANT FILE ON *.* TO 'nopriv_user'@'localhost';
|
|
|
|
FLUSH PRIVILEGES;
|
|
|
|
connect (con1,localhost,nopriv_user,,);
|
|
connection con1;
|
|
--echo connection: con1
|
|
|
|
--error ER_PROCACCESS_DENIED_ERROR
|
|
SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE 'mytest';
|
|
|
|
--error ER_PROCACCESS_DENIED_ERROR
|
|
INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1;
|
|
|
|
--error ER_PROCACCESS_DENIED_ERROR
|
|
SELECT MAX(key1) INTO @dummy FROM t1 WHERE f() < 1;
|
|
|
|
--error ER_PROCACCESS_DENIED_ERROR
|
|
CREATE TABLE t3 (i INT) AS SELECT MAX(key1) FROM t1 WHERE f() < 1;
|
|
|
|
disconnect con1;
|
|
--source include/wait_until_disconnected.inc
|
|
|
|
connection default;
|
|
--echo connection: default
|
|
|
|
DROP TABLE t1,t2;
|
|
DROP FUNCTION f;
|
|
DROP USER nopriv_user@localhost;
|
|
|
|
--echo #
|
|
--echo # End Bug#54812
|
|
--echo #
|