Commit 132ccf93 authored by Jon Olav Hauglid's avatar Jon Olav Hauglid

Bug #54401 assert in Diagnostics_area::set_eof_status , HANDLER

This assert checks that the server does not try to send EOF to the
client if there has been some error during processing. This to make
sure that the error is in fact sent to the client.

The problem was that any errors during processing of WHERE conditions
in HANDLER ... READ statements where not detected by the handler code.
The handler code therefore still tried to send EOF to the client,
triggering the assert. The bug was only noticeable in debug builds.

This patch fixes the problem by making sure that the handler code
checks for errors during condition processing and acts accordingly.
parent 05617af0
...@@ -1757,3 +1757,35 @@ disconnect con51355; ...@@ -1757,3 +1757,35 @@ disconnect con51355;
--echo # Connection default --echo # Connection default
connection default; connection default;
--echo #
--echo # Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP FUNCTION IF EXISTS f1;
--enable_warnings
delimiter |;
CREATE FUNCTION f1() RETURNS INTEGER
BEGIN
SELECT 1 FROM t2 INTO @a;
RETURN 1;
END|
delimiter ;|
# Get f1() parsed and cached
--error ER_NO_SUCH_TABLE
SELECT f1();
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
HANDLER t1 OPEN;
# This used to cause the assert
--error ER_NO_SUCH_TABLE
HANDLER t1 READ FIRST WHERE f1() = 1;
HANDLER t1 CLOSE;
DROP FUNCTION f1;
DROP TABLE t1;
...@@ -1710,3 +1710,23 @@ ERROR 42S02: Table 'test.t1' doesn't exist ...@@ -1710,3 +1710,23 @@ ERROR 42S02: Table 'test.t1' doesn't exist
HANDLER t1 CLOSE; HANDLER t1 CLOSE;
# Connection con51355 # Connection con51355
# Connection default # Connection default
#
# Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
#
DROP TABLE IF EXISTS t1, t2;
DROP FUNCTION IF EXISTS f1;
CREATE FUNCTION f1() RETURNS INTEGER
BEGIN
SELECT 1 FROM t2 INTO @a;
RETURN 1;
END|
SELECT f1();
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
HANDLER t1 OPEN;
HANDLER t1 READ FIRST WHERE f1() = 1;
ERROR 42S02: Table 'test.t2' doesn't exist
HANDLER t1 CLOSE;
DROP FUNCTION f1;
DROP TABLE t1;
...@@ -1707,6 +1707,26 @@ HANDLER t1 CLOSE; ...@@ -1707,6 +1707,26 @@ HANDLER t1 CLOSE;
# Connection con51355 # Connection con51355
# Connection default # Connection default
# #
# Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
#
DROP TABLE IF EXISTS t1, t2;
DROP FUNCTION IF EXISTS f1;
CREATE FUNCTION f1() RETURNS INTEGER
BEGIN
SELECT 1 FROM t2 INTO @a;
RETURN 1;
END|
SELECT f1();
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
HANDLER t1 OPEN;
HANDLER t1 READ FIRST WHERE f1() = 1;
ERROR 42S02: Table 'test.t2' doesn't exist
HANDLER t1 CLOSE;
DROP FUNCTION f1;
DROP TABLE t1;
#
# BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash # BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash
# #
CREATE TABLE t1 AS SELECT 1 AS f1; CREATE TABLE t1 AS SELECT 1 AS f1;
......
...@@ -747,7 +747,11 @@ retry: ...@@ -747,7 +747,11 @@ retry:
goto ok; goto ok;
} }
if (cond && !cond->val_int()) if (cond && !cond->val_int())
{
if (thd->is_error())
goto err;
continue; continue;
}
if (num_rows >= offset_limit_cnt) if (num_rows >= offset_limit_cnt)
{ {
protocol->prepare_for_resend(); protocol->prepare_for_resend();
......
Markdown is supported
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